Reputation: 1582
I created plugin that is supposed to have Input on Output directory, to run when any of these two changes. When I defined it in build.gradle for single task, it worked fine. When defined in Java by Gradle API, only directory defined as Inputs triggers the re-run of task.
task.getInputs().dir(target.file("./src/main/res/values/"));
task.getOutputs().dir(target.file("./inputs/"));
Tried setting setDidWork(true);
but that did not help. And any change in output does not trigger change in UP-TO-DATE status of this task.
Upvotes: 3
Views: 380
Reputation: 1582
I used annotations on task class, that are called in correct time and work.
@OutputDirectory
public File getOutputDir() {
return getProject().getRootProject().file(extension.getOutputPath());
}
@InputDirectory
public File getInputsDir() {
return getProject().getRootProject().file(extension.getPath());
}
Upvotes: 1