Following up on How to create SourceSetContainer? I could never figure out how to create a SourceSetContainer so I ended up just keeping track of the SourceSetOutputs I need[1]. I want to combine this with incremental task inputs. The trouble I am having is figuring out how to query the input changes for a particular SourceSetOutput directory.
@Internal
@SkipWhenEmpty
@Incremental
public SourceSetOutput getSources() {
return sources;
}
@TaskAction
public void enhanceClasses(InputChanges inputChanges) {
for ( File classesDir : sources.getClassesDirs() ) {
// does not like - presumably InputChanges only works
// for the complete incremental property
final Iterable<FileChange> fileChanges = inputChanges.getFileChanges( project.fileTree( classesDir ) );
...
}
}
The use case is that I need to be able to determine the class name for each file as I process it from the InputChanges. Alternatives to achieve that are very welcome.
[1] For background this is a bytecode enhancement task and I need to process a SourceSetOutput to access the compiled classes.