use of org.gradle.api.tasks.TaskAction in project gradle by gradle.
the class DependentComponentsReport method report.
@TaskAction
public void report() {
// Cross-project ModelRegistry operations do not happen concurrently.
synchronized (DependentComponentsReport.class) {
Project project = getProject();
ModelRegistry modelRegistry = getModelRegistry();
DependentBinariesResolver dependentBinariesResolver = modelRegistry.find("dependentBinariesResolver", DependentBinariesResolver.class);
StyledTextOutput textOutput = getTextOutputFactory().create(DependentComponentsReport.class);
TextDependentComponentsReportRenderer reportRenderer = new TextDependentComponentsReportRenderer(dependentBinariesResolver, showNonBuildable, showTestSuites);
reportRenderer.setOutput(textOutput);
reportRenderer.startProject(project);
Set<ComponentSpec> allComponents = getAllComponents(modelRegistry);
if (showTestSuites) {
allComponents.addAll(getAllTestSuites(modelRegistry));
}
reportRenderer.renderComponents(getReportedComponents(allComponents));
reportRenderer.renderLegend();
reportRenderer.completeProject(project);
reportRenderer.complete();
}
}
use of org.gradle.api.tasks.TaskAction in project gradle by gradle.
the class AntTarget method executeAntTarget.
@TaskAction
protected void executeAntTarget() {
File oldBaseDir = target.getProject().getBaseDir();
target.getProject().setBaseDir(baseDir);
try {
target.performTasks();
} finally {
target.getProject().setBaseDir(oldBaseDir);
}
}
use of org.gradle.api.tasks.TaskAction in project gradle by gradle.
the class GeneratorTask method generate.
@SuppressWarnings("UnusedDeclaration")
@TaskAction
void generate() {
File inputFile = getInputFileIfExists();
if (inputFile != null) {
try {
domainObject = generator.read(inputFile);
} catch (RuntimeException e) {
throw new GradleException(String.format("Cannot parse file '%s'.\n" + " Perhaps this file was tinkered with? In that case try delete this file and then retry.", inputFile), e);
}
} else {
domainObject = generator.defaultInstance();
}
beforeConfigured.execute(domainObject);
generator.configure(domainObject);
afterConfigured.execute(domainObject);
generator.write(domainObject, getOutputFile());
}
use of org.gradle.api.tasks.TaskAction in project gradle by gradle.
the class FindBugs method run.
@TaskAction
public void run() throws IOException, InterruptedException {
new FindBugsClasspathValidator(JavaVersion.current()).validateClasspath(Iterables.transform(getFindbugsClasspath().getFiles(), new Function<File, String>() {
@Override
public String apply(File input) {
return input.getName();
}
}));
FindBugsSpec spec = generateSpec();
FindBugsWorkerManager manager = new FindBugsWorkerManager();
getLogging().captureStandardOutput(LogLevel.DEBUG);
getLogging().captureStandardError(LogLevel.DEBUG);
FindBugsResult result = manager.runWorker(getProject().getProjectDir(), getWorkerProcessBuilderFactory(), getFindbugsClasspath(), spec);
evaluateResult(result);
}
use of org.gradle.api.tasks.TaskAction in project gradle by gradle.
the class CompositeBuildTaskDelegate method executeTasksInOtherBuild.
@TaskAction
public void executeTasksInOtherBuild() {
IncludedBuilds includedBuilds = getServices().get(IncludedBuilds.class);
IncludedBuildExecuter builder = getServices().get(IncludedBuildExecuter.class);
IncludedBuild includedBuild = includedBuilds.getBuild(build);
BuildIdentifier buildId = new DefaultBuildIdentifier(includedBuild.getName());
// sourceBuild is currently always root build in a composite
builder.execute(new DefaultBuildIdentifier(":", true), buildId, tasks);
}
Aggregations