use of org.gradle.api.tasks.TaskAction in project gradle by gradle.
the class GroovyCompile method compile.
@Override
@TaskAction
protected void compile() {
checkGroovyClasspathIsNonEmpty();
DefaultGroovyJavaJointCompileSpec spec = createSpec();
WorkResult result = getCompiler(spec).execute(spec);
setDidWork(result.getDidWork());
}
use of org.gradle.api.tasks.TaskAction 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);
}
use of org.gradle.api.tasks.TaskAction in project gradle by gradle.
the class ModelReport method report.
@TaskAction
public void report() {
Project project = getProject();
StyledTextOutput textOutput = getTextOutputFactory().create(ModelReport.class);
ModelNodeRenderer renderer = new ModelNodeRenderer(isShowHidden(), getFormat());
TextModelReportRenderer textModelReportRenderer = new TextModelReportRenderer(renderer);
textModelReportRenderer.setOutput(textOutput);
textModelReportRenderer.startProject(project);
ModelRegistry modelRegistry = getModelRegistry();
ModelNode rootNode = modelRegistry.realizeNode(ModelPath.ROOT);
// Ensure binding validation has been done. This should happen elsewhere
modelRegistry.bindAllReferences();
textModelReportRenderer.render(rootNode);
textModelReportRenderer.completeProject(project);
textModelReportRenderer.complete();
}
use of org.gradle.api.tasks.TaskAction in project gradle by gradle.
the class AbstractReportTask method generate.
@TaskAction
public void generate() {
ProjectReportGenerator projectReportGenerator = new ProjectReportGenerator() {
@Override
public void generateReport(Project project) throws IOException {
generate(project);
if (shouldCreateReportFile()) {
project.getLogger().lifecycle("See the report at: {}", new ConsoleRenderer().asClickableFileUrl(getOutputFile()));
}
}
};
ReportGenerator reportGenerator = new ReportGenerator(getRenderer(), getClientMetaData(), getOutputFile(), getTextOutputFactory(), projectReportGenerator);
reportGenerator.generateReport(new TreeSet<Project>(getProjects()));
}
use of org.gradle.api.tasks.TaskAction in project gradle by gradle.
the class ComponentReport method report.
@TaskAction
public void report() {
Project project = getProject();
StyledTextOutput textOutput = getTextOutputFactory().create(ComponentReport.class);
ComponentReportRenderer renderer = new ComponentReportRenderer(getFileResolver(), getBinaryRenderer());
renderer.setOutput(textOutput);
renderer.startProject(project);
Collection<ComponentSpec> components = new ArrayList<ComponentSpec>();
ComponentSpecContainer componentSpecs = modelElement("components", ComponentSpecContainer.class);
if (componentSpecs != null) {
components.addAll(componentSpecs.values());
}
ModelMap<ComponentSpec> testSuites = modelElement("testSuites", modelMap(ComponentSpec.class));
if (testSuites != null) {
components.addAll(testSuites.values());
}
renderer.renderComponents(components);
ProjectSourceSet sourceSets = modelElement("sources", ProjectSourceSet.class);
if (sourceSets != null) {
renderer.renderSourceSets(sourceSets);
}
BinaryContainer binaries = modelElement("binaries", BinaryContainer.class);
if (binaries != null) {
renderer.renderBinaries(binaries.values());
}
renderer.completeProject(project);
renderer.complete();
}
Aggregations