use of org.gradle.api.plugins.antlr.internal.AntlrResult in project gradle by gradle.
the class AntlrTask method execute.
@TaskAction
public void execute(IncrementalTaskInputs inputs) {
final Set<File> grammarFiles = new HashSet<File>();
final Set<File> sourceFiles = getSource().getFiles();
final AtomicBoolean cleanRebuild = new AtomicBoolean();
inputs.outOfDate(new Action<InputFileDetails>() {
public void execute(InputFileDetails details) {
File input = details.getFile();
if (sourceFiles.contains(input)) {
grammarFiles.add(input);
} else {
// classpath change?
cleanRebuild.set(true);
}
}
});
inputs.removed(new Action<InputFileDetails>() {
@Override
public void execute(InputFileDetails details) {
if (details.isRemoved()) {
cleanRebuild.set(true);
}
}
});
if (cleanRebuild.get()) {
GFileUtils.cleanDirectory(outputDirectory);
grammarFiles.addAll(sourceFiles);
}
AntlrWorkerManager manager = new AntlrWorkerManager();
AntlrSpec spec = new AntlrSpecFactory().create(this, grammarFiles, sourceDirectorySet);
AntlrResult result = manager.runWorker(getProject().getProjectDir(), getWorkerProcessBuilderFactory(), getAntlrClasspath(), spec);
evaluate(result);
}
Aggregations