From 3185dbb23094493c3e34c8d2352e39967eb5200e Mon Sep 17 00:00:00 2001 From: Markus KARG Date: Fri, 22 Mar 2024 14:46:31 +0100 Subject: [PATCH] Parallel execution of uptodate-properties --- .../buildhelper/AbstractUpToDatePropertyMojo.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/codehaus/mojo/buildhelper/AbstractUpToDatePropertyMojo.java b/src/main/java/org/codehaus/mojo/buildhelper/AbstractUpToDatePropertyMojo.java index 59e78216..1fef291f 100644 --- a/src/main/java/org/codehaus/mojo/buildhelper/AbstractUpToDatePropertyMojo.java +++ b/src/main/java/org/codehaus/mojo/buildhelper/AbstractUpToDatePropertyMojo.java @@ -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; @@ -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 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 { @@ -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()) { @@ -89,10 +88,8 @@ protected void execute(UpToDatePropertySetting config) throws MojoExecutionExcep } } - if (!upToDate) { - break; - } - } + return isUpToDate; + }); } catch (MapperException e) { throw new MojoExecutionException("", e); }