Slackbot
04/21/2022, 8:32 AMVampire
04/21/2022, 8:39 AM@Optional
@InputFiles
getter that calculates the dependencies from the input file and returns the files. If the calculation is really triggered multiple times (don't remember right now) you could add a simple hash based cache.Vampire
04/21/2022, 8:39 AMAndreas Kalo Fogados
04/21/2022, 2:05 PM@InputFile
@PathSensitive(PathSensitivity.NAME_ONLY)
public Provider<Path> getInputFile() {
return this.inputFile;
}
public void setInputFile(final Path inputFile) {
this.inputFile.set(inputFile);
}
@Optional
@InputFiles
public Provider<ConfigurableFileCollection> getAdditionalInput() {
return this.inputFile.map(inputFile -> {
final List<Path> calculatedAdditionalPaths = new ArrayList<>();
// read additional input paths from inputFile
System.out.println("-> Calculation called");
return getProject().files(calculatedAdditionalPaths);
});
}
The output of the project configuration:
...
All projects evaluated.
Selected primary task 'build' from project :
-> Calculation called
Tasks to be executed: ...
I also tried it in a non-lazy fashion, but there was no difference.
Do you maybe know how to avoid that call of the getter during configuration phase?Vampire
04/21/2022, 2:10 PMAndreas Kalo Fogados
04/21/2022, 2:26 PMVampire
04/21/2022, 2:39 PMAndreas Kalo Fogados
04/21/2022, 2:59 PMVampire
04/21/2022, 3:05 PM