Skip to content

Commit 923e079

Browse files
committed
Fix build issues
1 parent c011029 commit 923e079

File tree

6 files changed

+224
-58
lines changed

6 files changed

+224
-58
lines changed

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ See the Apache License Version 2.0 for the specific language governing permissio
2424
<version>0.0.8-SNAPSHOT</version>
2525

2626
<dependencies>
27+
<dependency>
28+
<groupId>org.codehaus.plexus</groupId>
29+
<artifactId>plexus-component-annotations</artifactId>
30+
<scope>provided</scope>
31+
</dependency>
2732
<dependency>
2833
<groupId>org.codehaus.plexus</groupId>
2934
<artifactId>plexus-utils</artifactId>

src/main/java/org/sonatype/plexus/build/incremental/BuildContext.java

Lines changed: 86 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -21,172 +21,221 @@
2121

2222

2323
// TODO should it be BuildWorkspace or something like that?
24+
/**
25+
* <p>BuildContext interface.</p>
26+
*/
2427
public interface BuildContext {
28+
/** Constant <code>SEVERITY_WARNING=1</code> */
2529
int SEVERITY_WARNING = 1;
2630

31+
/** Constant <code>SEVERITY_ERROR=2</code> */
2732
int SEVERITY_ERROR = 2;
2833

2934
// TODO should we add File getBasedir()?
3035

3136
/**
32-
* Returns <code>true</code> if file or folder identified by <code>relpath</code> has
33-
* changed since last build.
34-
*
37+
* Returns <code>true</code> if file or folder identified by <code>relpath</code> has
38+
* changed since last build.
39+
*
3540
* @param relpath is path relative to build context basedir
41+
* @return a boolean.
3642
*/
3743
boolean hasDelta(String relpath);
3844

3945
/**
4046
* Returns <code>true</code> if the file has changed since last build or is not
4147
* under basedir.
42-
*
48+
*
4349
* @since 0.0.5
50+
* @param file a {@link java.io.File} object.
51+
* @return a boolean.
4452
*/
4553
boolean hasDelta(File file);
4654

4755
/**
48-
* Returns <code>true</code> if any file or folder identified by <code>relpaths</code> has
56+
* Returns <code>true</code> if any file or folder identified by <code>relpaths</code> has
4957
* changed since last build.
50-
*
51-
* @param relpaths List<String> are paths relative to build context basedir
58+
*
59+
* @param relpaths paths relative to build context basedir
60+
* @return a boolean.
5261
*/
5362
boolean hasDelta(List<String> relpaths);
5463

5564
/**
5665
* Indicates that the file or folder content has been modified during the build.
57-
*
66+
*
5867
* @see #newFileOutputStream(File)
68+
* @param file a {@link java.io.File} object.
5969
*/
6070
void refresh(File file);
6171

6272
/**
6373
* Returns new OutputStream that writes to the <code>file</code>.
64-
*
74+
*
6575
* Files changed using OutputStream returned by this method do not need to be
6676
* explicitly refreshed using {@link #refresh(File)}.
6777
*
68-
* As an optional optimisation, OutputStreams created by incremental build
69-
* context will attempt to avoid writing to the file if file content
78+
* As an optional optimisation, OutputStreams created by incremental build
79+
* context will attempt to avoid writing to the file if file content
7080
* has not changed.
81+
*
82+
* @param file a {@link java.io.File} object.
83+
* @return a {@link java.io.OutputStream} object.
84+
* @throws java.io.IOException if any.
7185
*/
7286
OutputStream newFileOutputStream(File file) throws IOException;
7387

7488
/**
7589
* Convenience method, fully equal to newScanner(basedir, false)
90+
*
91+
* @param basedir a {@link java.io.File} object.
92+
* @return a {@link org.codehaus.plexus.util.Scanner} object.
7693
*/
7794
Scanner newScanner(File basedir);
7895

7996
/**
80-
* Returned Scanner scans <code>basedir</code> for files and directories
97+
* Returned Scanner scans <code>basedir</code> for files and directories
8198
* deleted since last build. Returns empty Scanner if <code>basedir</code>
8299
* is not under this build context basedir.
100+
*
101+
* @param basedir a {@link java.io.File} object.
102+
* @return a {@link org.codehaus.plexus.util.Scanner} object.
83103
*/
84104
Scanner newDeleteScanner(File basedir);
85105

86106
/**
87107
* Returned Scanner scans files and folders under <code>basedir</code>.
88-
*
89-
* If this is an incremental build context and <code>ignoreDelta</code>
90-
* is <code>false</code>, the scanner will only "see" files and folders with
91-
* content changes since last build.
92-
*
108+
*
109+
* If this is an incremental build context and <code>ignoreDelta</code>
110+
* is <code>false</code>, the scanner will only "see" files and folders with
111+
* content changes since last build.
112+
*
93113
* If <code>ignoreDelta</code> is <code>true</code>, the scanner will "see" all
94-
* files and folders.
95-
*
114+
* files and folders.
115+
*
96116
* Please beware that ignoreDelta=false does NOT work reliably for operations
97117
* that copy resources from source to target locations. Returned Scanner
98118
* only scans changed source resources and it does not consider changed or deleted
99119
* target resources. This results in missing or stale target resources.
100120
* Starting with 0.5.0, recommended way to process resources is to use
101121
* #newScanner(basedir,true) to locate all source resources and {@link #isUptodate(File, File)}
102-
* to optimized processing of uptodate target resources.
103-
*
122+
* to optimized processing of uptodate target resources.
123+
*
104124
* Returns empty Scanner if <code>basedir</code> is not under this build context basedir.
105-
*
125+
*
106126
* https://issues.apache.org/jira/browse/MSHARED-125
127+
*
128+
* @param basedir a {@link java.io.File} object.
129+
* @param ignoreDelta a boolean.
130+
* @return a {@link org.codehaus.plexus.util.Scanner} object.
107131
*/
108132
Scanner newScanner(File basedir, boolean ignoreDelta);
109133

110134
/**
111-
* Returns <code>true</code> if this build context is incremental.
112-
*
135+
* Returns <code>true</code> if this build context is incremental.
136+
*
113137
* Scanners created by {@link #newScanner(File)} of an incremental build context
114-
* will ignore files and folders that were not changed since last build.
138+
* will ignore files and folders that were not changed since last build.
115139
* Additionally, {@link #newDeleteScanner(File)} will scan files and directories
116140
* deleted since last build.
141+
*
142+
* @return a boolean.
117143
*/
118144
boolean isIncremental();
119145

120146
/**
121147
* Associate specified <code>key</code> with specified <code>value</code>
122148
* in the build context.
123-
*
124-
* Primary (and the only) purpose of this method is to allow preservation of
125-
* state needed for proper incremental behaviour between consecutive executions
126-
* of the same mojo needed to.
127-
*
149+
*
150+
* Primary (and the only) purpose of this method is to allow preservation of
151+
* state needed for proper incremental behaviour between consecutive executions
152+
* of the same mojo needed to.
153+
*
128154
* For example, maven-plugin-plugin:descriptor mojo
129155
* can store collection of extracted MojoDescritpor during first invocation. Then
130156
* on each consecutive execution maven-plugin-plugin:descriptor will only need
131157
* to extract MojoDescriptors for changed files.
132158
*
133159
* @see #getValue(String)
160+
* @param key a {@link java.lang.String} object.
161+
* @param value a {@link java.lang.Object} object.
134162
*/
135163
void setValue(String key, Object value);
136164

137165
/**
138166
* Returns value associated with <code>key</code> during previous mojo execution.
139-
*
167+
*
140168
* This method always returns <code>null</code> for non-incremental builds
141-
* (i.e., {@link #isIncremental()} returns <code>false</code>) and mojos are
169+
* (i.e., {@link #isIncremental()} returns <code>false</code>) and mojos are
142170
* expected to fall back to full, non-incremental behaviour.
143-
*
171+
*
144172
* @see #setValue(String, Object)
145173
* @see #isIncremental()
174+
* @param key a {@link java.lang.String} object.
175+
* @return a {@link java.lang.Object} object.
146176
*/
147177
Object getValue(String key);
148178

149179
/**
180+
* <p>addWarning.</p>
181+
*
150182
* @deprecated Use addMessage with severity=SEVERITY_ERROR instead
151183
* @since 0.0.5
184+
* @param file a {@link java.io.File} object.
185+
* @param line a int.
186+
* @param column a int.
187+
* @param message a {@link java.lang.String} object.
188+
* @param cause a {@link java.lang.Throwable} object.
152189
*/
153190
void addWarning(File file, int line, int column, String message, Throwable cause);
154191

155192
/**
193+
* <p>addError.</p>
194+
*
156195
* @deprecated Use addMessage with severity=SEVERITY_WARNING instead
157196
* @since 0.0.5
197+
* @param file a {@link java.io.File} object.
198+
* @param line a int.
199+
* @param column a int.
200+
* @param message a {@link java.lang.String} object.
201+
* @param cause a {@link java.lang.Throwable} object.
158202
*/
159203
void addError(File file, int line, int column, String message, Throwable cause);
160204

161205
/**
162206
* Adds a message to the build context. The message is associated with a file and a location inside that file.
163-
*
207+
*
164208
* @param file The file or folder with which the message is associated. Should not be null and it is recommended to be
165209
* an absolute path.
166210
* @param line The line number inside the file. Use 1 (not 0) for the first line. Use 0 for unknown/unspecified.
167211
* @param column The column number inside the file. Use 1 (not 0) for the first column. Use 0 for unknown/unspecified.
168212
* @param severity The severity of the message: SEVERITY_WARNING or SEVERITY_ERROR.
169213
* @param cause A Throwable object associated with the message. Can be null.
170214
* @since 0.0.7
215+
* @param message a {@link java.lang.String} object.
171216
*/
172217
void addMessage(File file, int line, int column, String message, int severity, Throwable cause);
173218

174219
/**
175220
* Removes all messages associated with a file or folder during a previous build. It does not affect the messages
176221
* added during the current build.
177-
*
222+
*
178223
* @since 0.0.7
224+
* @param file a {@link java.io.File} object.
179225
*/
180226
void removeMessages(File file);
181227

182228
/**
183229
* Returns true, if the target file exists and is uptodate compared to the source file.
184-
*
230+
*
185231
* More specifically, this method returns true when both target and source files exist,
186232
* do not have changes since last incremental build and the target file was last modified
187233
* later than the source file. Returns false in all other cases.
188-
*
234+
*
189235
* @since 0.0.5
236+
* @param target a {@link java.io.File} object.
237+
* @param source a {@link java.io.File} object.
238+
* @return a boolean.
190239
*/
191240
boolean isUptodate(File target, File source);
192241
}

0 commit comments

Comments
 (0)