29
29
import java .util .Set ;
30
30
import java .util .concurrent .ConcurrentHashMap ;
31
31
import java .util .concurrent .atomic .AtomicBoolean ;
32
+ import java .util .function .Predicate ;
32
33
33
34
import org .slf4j .Logger ;
34
35
import org .slf4j .LoggerFactory ;
@@ -210,8 +211,9 @@ private boolean hasRelevantDelta(IMavenProjectFacade projectFacade, IResourceDel
210
211
return true ;
211
212
}
212
213
213
- IPath outputLocation = projectFacade .getOutputLocation ();
214
- IPath testOutputLocation = projectFacade .getTestOutputLocation ();
214
+ Predicate <IPath > isOutput = toPrefixPredicate (projectFacade .getOutputLocation ());
215
+ Predicate <IPath > isTestOutput = toPrefixPredicate (projectFacade .getTestOutputLocation ());
216
+ Predicate <IPath > isOutputOrTestOutput = isOutput .or (isTestOutput );
215
217
216
218
IPath projectPath = project .getFullPath ();
217
219
List <IPath > moduleLocations = projectFacade .getMavenProjectModules ().stream ()
@@ -224,8 +226,7 @@ private boolean hasRelevantDelta(IMavenProjectFacade projectFacade, IResourceDel
224
226
if (buildOutputLocation .isPrefixOf (fullPath )) {
225
227
//anything in the build output is not interesting for a change as it is produced by the build
226
228
// ... unless a classpath resource that existed before has been deleted, possibly by another builder
227
- if (!resource .exists () && ((outputLocation != null && outputLocation .isPrefixOf (fullPath ))
228
- || (testOutputLocation != null && testOutputLocation .isPrefixOf (fullPath )))) {
229
+ if (!resource .exists () && isOutputOrTestOutput .test (fullPath )) {
229
230
hasRelevantDelta .set (true );
230
231
return false ;
231
232
}
@@ -246,6 +247,13 @@ private boolean hasRelevantDelta(IMavenProjectFacade projectFacade, IResourceDel
246
247
return hasRelevantDelta .get ();
247
248
}
248
249
250
+ private static Predicate <IPath > toPrefixPredicate (IPath location ) {
251
+ if (location == null ) {
252
+ return (p ) -> false ;
253
+ }
254
+ return (p ) -> location .isPrefixOf (p );
255
+ }
256
+
249
257
private List <IIncrementalBuildFramework .BuildContext > setupProjectBuildContext (IProject project , int kind ,
250
258
IResourceDelta delta , IIncrementalBuildFramework .BuildResultCollector results , ProjectBuildState buildState )
251
259
throws CoreException {
0 commit comments