Skip to content

Commit 3185dbb

Browse files
mkargslawekjaranowski
authored andcommitted
Parallel execution of uptodate-properties
1 parent 54d1683 commit 3185dbb

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/main/java/org/codehaus/mojo/buildhelper/AbstractUpToDatePropertyMojo.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.io.File;
2323
import java.io.IOException;
2424
import java.util.Map;
25-
import java.util.Map.Entry;
2625

2726
import org.apache.maven.plugin.MojoExecutionException;
2827
import org.apache.maven.plugin.MojoFailureException;
@@ -63,11 +62,11 @@ protected void execute(UpToDatePropertySetting config) throws MojoExecutionExcep
6362
// Treat a file set that yields no files as intrinsically out of date.
6463
upToDate = !includedFiles.isEmpty();
6564

66-
for (Entry<String, String> entry : includedFiles.entrySet()) {
65+
upToDate &= includedFiles.entrySet().parallelStream().allMatch(entry -> {
6766
// If targetFile is out of date WRT srcFile, note the fact and stop processing.
6867
File srcFile = getFile(fileSet, false, entry.getKey());
6968
File targetFile = getFile(fileSet, true, entry.getValue());
70-
upToDate = isUpToDate(srcFile, targetFile);
69+
boolean isUpToDate = isUpToDate(srcFile, targetFile);
7170

7271
if (getLog().isDebugEnabled()) {
7372
try {
@@ -76,7 +75,7 @@ protected void execute(UpToDatePropertySetting config) throws MojoExecutionExcep
7675
msg.append(" (nonexistent)");
7776
}
7877
msg.append("\n\tis ")
79-
.append(upToDate ? "up to date" : "out of date")
78+
.append(isUpToDate ? "up to date" : "out of date")
8079
.append(" with respect to \n\t")
8180
.append(srcFile.getCanonicalPath());
8281
if (!srcFile.exists()) {
@@ -89,10 +88,8 @@ protected void execute(UpToDatePropertySetting config) throws MojoExecutionExcep
8988
}
9089
}
9190

92-
if (!upToDate) {
93-
break;
94-
}
95-
}
91+
return isUpToDate;
92+
});
9693
} catch (MapperException e) {
9794
throw new MojoExecutionException("", e);
9895
}

0 commit comments

Comments
 (0)