use of org.gradle.initialization.BuildClientMetaData in project gradle by gradle.
the class Help method displayHelp.
@TaskAction
void displayHelp() {
StyledTextOutput output = getTextOutputFactory().create(Help.class);
BuildClientMetaData metaData = getClientMetaData();
if (taskPath != null) {
printTaskHelp(output);
} else {
printDefaultHelp(output, metaData);
}
}
use of org.gradle.initialization.BuildClientMetaData in project gradle by gradle.
the class AbstractReportTaskTest method passesEachProjectToRenderer.
@Test
public void passesEachProjectToRenderer() throws IOException {
final Project child1 = createChildProject(project, "child1");
final Project child2 = createChildProject(project, "child2");
task.setProjects(project.getAllprojects());
context.checking(new Expectations() {
{
Sequence sequence = context.sequence("seq");
one(renderer).setClientMetaData((BuildClientMetaData) with(notNullValue()));
inSequence(sequence);
one(renderer).setOutput((StyledTextOutput) with(notNullValue()));
inSequence(sequence);
one(renderer).startProject(project);
inSequence(sequence);
one(generator).run();
inSequence(sequence);
one(renderer).completeProject(project);
inSequence(sequence);
one(renderer).startProject(child1);
inSequence(sequence);
one(generator).run();
inSequence(sequence);
one(renderer).completeProject(child1);
inSequence(sequence);
one(renderer).startProject(child2);
inSequence(sequence);
one(generator).run();
inSequence(sequence);
one(renderer).completeProject(child2);
inSequence(sequence);
one(renderer).complete();
inSequence(sequence);
}
});
task.generate();
}
use of org.gradle.initialization.BuildClientMetaData in project gradle by gradle.
the class AbstractReportTaskTest method setsOutputFileNameOnRendererBeforeGeneration.
@Test
public void setsOutputFileNameOnRendererBeforeGeneration() throws IOException {
final File file = tmpDir.getTestDirectory().file("report.txt");
context.checking(new Expectations() {
{
Sequence sequence = context.sequence("sequence");
one(renderer).setClientMetaData((BuildClientMetaData) with(notNullValue()));
inSequence(sequence);
one(renderer).setOutputFile(file);
inSequence(sequence);
one(renderer).startProject(project);
inSequence(sequence);
one(generator).run();
inSequence(sequence);
one(renderer).completeProject(project);
inSequence(sequence);
one(renderer).complete();
inSequence(sequence);
}
});
task.setOutputFile(file);
task.generate();
}
use of org.gradle.initialization.BuildClientMetaData in project gradle by gradle.
the class AbstractReportTaskTest method completesRendererAtEndOfGeneration.
@Test
public void completesRendererAtEndOfGeneration() throws IOException {
context.checking(new Expectations() {
{
Sequence sequence = context.sequence("sequence");
one(renderer).setClientMetaData((BuildClientMetaData) with(notNullValue()));
inSequence(sequence);
one(renderer).setOutput((StyledTextOutput) with(notNullValue()));
inSequence(sequence);
one(renderer).startProject(project);
inSequence(sequence);
one(generator).run();
inSequence(sequence);
one(renderer).completeProject(project);
inSequence(sequence);
one(renderer).complete();
inSequence(sequence);
}
});
task.generate();
}
use of org.gradle.initialization.BuildClientMetaData in project gradle by gradle.
the class ProjectReportTask method generate.
@Override
protected void generate(Project project) throws IOException {
BuildClientMetaData metaData = getClientMetaData();
StyledTextOutput textOutput = getRenderer().getTextOutput();
render(project, new GraphRenderer(textOutput), true, textOutput);
if (project.getChildProjects().isEmpty()) {
textOutput.withStyle(Info).text("No sub-projects");
textOutput.println();
}
textOutput.println();
textOutput.text("To see a list of the tasks of a project, run ");
metaData.describeCommand(textOutput.withStyle(UserInput), "<project-path>:" + ProjectInternal.TASKS_TASK);
textOutput.println();
textOutput.text("For example, try running ");
Project exampleProject = project.getChildProjects().isEmpty() ? project : getChildren(project).get(0);
metaData.describeCommand(textOutput.withStyle(UserInput), exampleProject.absoluteProjectPath(ProjectInternal.TASKS_TASK));
textOutput.println();
if (project != project.getRootProject()) {
textOutput.println();
textOutput.text("To see a list of all the projects in this build, run ");
metaData.describeCommand(textOutput.withStyle(UserInput), project.getRootProject().absoluteProjectPath(ProjectInternal.PROJECTS_TASK));
textOutput.println();
}
}
Aggregations