Skip to content

Commit 51a15c1

Browse files
committed
Ignore java source code for lombok config up-to-date checks
see #549
1 parent efbc32e commit 51a15c1

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

examples/lombok/lombok.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import dummy/foo.config
1+
#import dummy/foo.config
22
config.stopbubbling = false
33
lombok.allArgsConstructor.flagUsage=WARNING
44
lombok.extern.findbugs.addSuppressFBWarnings = true

lombok-plugin/src/main/java/io/freefair/gradle/plugins/lombok/tasks/LombokConfig.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.io.FileOutputStream;
2525
import java.io.IOException;
2626
import java.io.OutputStream;
27+
import java.nio.file.Files;
2728
import java.util.*;
2829
import java.util.stream.Collectors;
2930

@@ -78,8 +79,7 @@ public class LombokConfig extends DefaultTask implements LombokTask {
7879
/**
7980
* Paths to java files or directories the configuration is to be printed for.
8081
*/
81-
@InputFiles
82-
@PathSensitive(PathSensitivity.ABSOLUTE)
82+
@Internal
8383
private final ConfigurableFileCollection paths = getProject().getObjects().fileCollection();
8484

8585
@OutputFile
@@ -97,6 +97,14 @@ public LombokConfig(WorkerExecutor workerExecutor, FileSystemOperations fileSyst
9797
getOutputs().upToDateWhen(t -> ((LombokConfig) t).getConfigFiles() != null);
9898
}
9999

100+
@Input
101+
protected List<String> getInputPaths() {
102+
return getPaths().getFiles()
103+
.stream()
104+
.map(File::getPath)
105+
.collect(Collectors.toList());
106+
}
107+
100108
@InputFiles
101109
@Optional
102110
@Nullable
@@ -158,7 +166,7 @@ public void exec() throws IOException {
158166
}
159167

160168
if (fork.getOrElse(false)) {
161-
try (OutputStream out = new FileOutputStream(outputFile.getAsFile().get())) {
169+
try (OutputStream out = Files.newOutputStream(outputFile.getAsFile().get().toPath())) {
162170

163171
execOperations.javaexec(config -> {
164172
if (launcher.isPresent()) {

0 commit comments

Comments
 (0)