From f7e396011947f4522828bc97cfe20468560ab4fc Mon Sep 17 00:00:00 2001 From: Tyler Bertrand Date: Fri, 21 Jun 2024 16:34:16 -0500 Subject: [PATCH 1/5] Update LombokConfig.getConfigFiles input property to use relative path normalization instead of absolute Absolute path normalization on this property causes the task to re-execute when the absolute path of the config files changes (if the project is moved to another directory, or the build is executed from a different path in a CI machine, for instance), even when none of the inputs have changed otherwise. --- .../io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java b/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java index 274c7754..953ae10d 100644 --- a/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java +++ b/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java @@ -110,7 +110,7 @@ protected List getInputPaths() { @InputFiles @Optional @Nullable - @PathSensitive(PathSensitivity.ABSOLUTE) + @PathSensitive(PathSensitivity.RELATIVE) @SneakyThrows protected Set getConfigFiles() { if (getPaths().isEmpty()) { From 48672d4efb89fc6a20a4f1e380b6cd3ec80adf0a Mon Sep 17 00:00:00 2001 From: Tyler Bertrand Date: Fri, 21 Jun 2024 16:45:22 -0500 Subject: [PATCH 2/5] Update LombokConfig.getInputPaths input property to use relative paths instead of absolute Using absolute paths for this property causes the task to re-execute when the absolute paths of the inputPaths changes (if the project is moved to another directory, or the build is executed from a different path in a CI machine, for instance), even when none of the inputs have changed otherwise. --- .../io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java b/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java index 953ae10d..7535159f 100644 --- a/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java +++ b/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java @@ -103,7 +103,7 @@ public LombokConfig() { protected List getInputPaths() { return getPaths().getFiles() .stream() - .map(File::getPath) + .map(getProject()::relativePath) .collect(Collectors.toList()); } From 08494cbb9fb69174ea5ca73e2f075a594375a223 Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Thu, 8 Aug 2024 01:13:42 +0200 Subject: [PATCH 3/5] Improve build-cache support --- .../freefair/gradle/plugins/lombok/tasks/LombokConfig.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java b/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java index 7535159f..4097c2db 100644 --- a/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java +++ b/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java @@ -9,6 +9,7 @@ import org.gradle.api.file.ConfigurableFileCollection; import org.gradle.api.file.FileSystemOperations; import org.gradle.api.file.RegularFileProperty; +import org.gradle.api.internal.file.FileOperations; import org.gradle.api.provider.ListProperty; import org.gradle.api.provider.Property; import org.gradle.api.tasks.Optional; @@ -43,6 +44,9 @@ public abstract class LombokConfig extends DefaultTask implements LombokTask { @Inject protected abstract FileSystemOperations getFileSystemOperations(); + @Inject + protected abstract FileOperations getFileOperations(); + @Inject protected abstract ExecOperations getExecOperations(); @@ -103,7 +107,7 @@ public LombokConfig() { protected List getInputPaths() { return getPaths().getFiles() .stream() - .map(getProject()::relativePath) + .map(getFileOperations()::relativePath) .collect(Collectors.toList()); } From 48d2723f3e136b3fdbf064229ef51c151f7a867b Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Thu, 8 Aug 2024 01:18:07 +0200 Subject: [PATCH 4/5] Improve build-cache support --- .../gradle/plugins/lombok/tasks/LombokConfig.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java b/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java index 4097c2db..d634cd90 100644 --- a/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java +++ b/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java @@ -8,6 +8,7 @@ import org.gradle.api.DefaultTask; import org.gradle.api.file.ConfigurableFileCollection; import org.gradle.api.file.FileSystemOperations; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.internal.file.FileOperations; import org.gradle.api.provider.ListProperty; @@ -45,7 +46,7 @@ public abstract class LombokConfig extends DefaultTask implements LombokTask { protected abstract FileSystemOperations getFileSystemOperations(); @Inject - protected abstract FileOperations getFileOperations(); + protected abstract ProjectLayout getProjectLayout(); @Inject protected abstract ExecOperations getExecOperations(); @@ -85,7 +86,8 @@ public abstract class LombokConfig extends DefaultTask implements LombokTask { /** * Paths to java files or directories the configuration is to be printed for. */ - @Internal + @InputFiles + @PathSensitive(PathSensitivity.RELATIVE) public abstract ConfigurableFileCollection getPaths(); @OutputFile @@ -103,14 +105,6 @@ public LombokConfig() { getOutputs().doNotCacheIf("Config Imports were used", t -> ((LombokConfig) t).getConfigFiles() == null); } - @Input - protected List getInputPaths() { - return getPaths().getFiles() - .stream() - .map(getFileOperations()::relativePath) - .collect(Collectors.toList()); - } - @InputFiles @Optional @Nullable From b78c34ea8a770bdac85148c3614c7d22e74473b2 Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Thu, 8 Aug 2024 01:18:32 +0200 Subject: [PATCH 5/5] Improve build-cache support --- .../freefair/gradle/plugins/lombok/tasks/LombokConfig.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java b/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java index d634cd90..0cb4c9b2 100644 --- a/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java +++ b/lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java @@ -8,9 +8,7 @@ import org.gradle.api.DefaultTask; import org.gradle.api.file.ConfigurableFileCollection; import org.gradle.api.file.FileSystemOperations; -import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; -import org.gradle.api.internal.file.FileOperations; import org.gradle.api.provider.ListProperty; import org.gradle.api.provider.Property; import org.gradle.api.tasks.Optional; @@ -45,9 +43,6 @@ public abstract class LombokConfig extends DefaultTask implements LombokTask { @Inject protected abstract FileSystemOperations getFileSystemOperations(); - @Inject - protected abstract ProjectLayout getProjectLayout(); - @Inject protected abstract ExecOperations getExecOperations();