Skip to content

Commit

Permalink
Parallel execution of uptodate-properties
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarg authored and slawekjaranowski committed Apr 3, 2024
1 parent 54d1683 commit 3185dbb
Showing 1 changed file with 5 additions and 8 deletions.
Expand Up @@ -22,7 +22,6 @@
import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.Map.Entry;

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

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

if (getLog().isDebugEnabled()) {
try {
Expand All @@ -76,7 +75,7 @@ protected void execute(UpToDatePropertySetting config) throws MojoExecutionExcep
msg.append(" (nonexistent)");
}
msg.append("\n\tis ")
.append(upToDate ? "up to date" : "out of date")
.append(isUpToDate ? "up to date" : "out of date")
.append(" with respect to \n\t")
.append(srcFile.getCanonicalPath());
if (!srcFile.exists()) {
Expand All @@ -89,10 +88,8 @@ protected void execute(UpToDatePropertySetting config) throws MojoExecutionExcep
}
}

if (!upToDate) {
break;
}
}
return isUpToDate;
});
} catch (MapperException e) {
throw new MojoExecutionException("", e);
}
Expand Down

0 comments on commit 3185dbb

Please sign in to comment.