use of org.gradle.internal.logging.text.StyledTextOutput in project gradle by gradle.
the class ModelNodeRenderer method render.
@Override
public void render(ModelNode model, TextReportBuilder output) {
if (model.isHidden() && !showHidden) {
return;
}
StyledTextOutput styledTextoutput = output.getOutput();
if (!model.getPath().equals(ModelPath.ROOT)) {
printNodeName(model, styledTextoutput);
maybePrintType(model, styledTextoutput);
maybePrintValue(model, styledTextoutput);
printCreator(model, styledTextoutput);
maybePrintRules(model, styledTextoutput);
}
if (model instanceof ModelReferenceNode) {
return;
}
Map<String, ModelNode> links = new TreeMap<String, ModelNode>();
for (ModelNode node : model.getLinks(ModelType.untyped())) {
links.put(node.getPath().getName(), node);
}
output.collection(links.values(), this);
}
use of org.gradle.internal.logging.text.StyledTextOutput in project gradle by gradle.
the class ProjectReportTask method render.
private void render(final Project project, GraphRenderer renderer, boolean lastChild, final StyledTextOutput textOutput) {
renderer.visit(new Action<StyledTextOutput>() {
public void execute(StyledTextOutput styledTextOutput) {
styledTextOutput.text(StringUtils.capitalize(project.toString()));
if (GUtil.isTrue(project.getDescription())) {
textOutput.withStyle(Description).format(" - %s", project.getDescription());
}
}
}, lastChild);
renderer.startChildren();
List<Project> children = getChildren(project);
for (Project child : children) {
render(child, renderer, child == children.get(children.size() - 1), textOutput);
}
renderer.completeChildren();
}
use of org.gradle.internal.logging.text.StyledTextOutput in project gradle by gradle.
the class NativeDependentBinariesResolutionStrategy method onCircularDependencies.
private void onCircularDependencies(final State state, final Deque<NativeBinarySpecInternal> stack, NativeBinarySpecInternal target) {
GraphNodeRenderer<NativeBinarySpecInternal> nodeRenderer = new GraphNodeRenderer<NativeBinarySpecInternal>() {
@Override
public void renderTo(NativeBinarySpecInternal node, StyledTextOutput output) {
String name = DependentComponentsUtils.getBuildScopedTerseName(node.getId());
output.withStyle(StyledTextOutput.Style.Identifier).text(name);
}
};
DirectedGraph<NativeBinarySpecInternal, Object> directedGraph = new DirectedGraph<NativeBinarySpecInternal, Object>() {
@Override
public void getNodeValues(NativeBinarySpecInternal node, Collection<? super Object> values, Collection<? super NativeBinarySpecInternal> connectedNodes) {
for (NativeBinarySpecInternal binary : stack) {
if (state.getDependents(node).contains(binary)) {
connectedNodes.add(binary);
}
}
}
};
DirectedGraphRenderer<NativeBinarySpecInternal> graphRenderer = new DirectedGraphRenderer<NativeBinarySpecInternal>(nodeRenderer, directedGraph);
StringWriter writer = new StringWriter();
graphRenderer.renderTo(target, writer);
throw new CircularReferenceException(String.format("Circular dependency between the following binaries:%n%s", writer.toString()));
}
use of org.gradle.internal.logging.text.StyledTextOutput in project gradle by gradle.
the class BuildExceptionReporter method renderSingleBuildException.
private void renderSingleBuildException(Throwable failure) {
StyledTextOutput output = textOutputFactory.create(BuildExceptionReporter.class, LogLevel.ERROR);
FailureDetails details = constructFailureDetails("Build", failure);
output.println();
output.withStyle(Failure).text("FAILURE: ");
details.summary.writeTo(output.withStyle(Failure));
output.println();
writeFailureDetails(output, details);
}
use of org.gradle.internal.logging.text.StyledTextOutput in project gradle by gradle.
the class BuildExceptionReporter method renderMultipleBuildExceptions.
private void renderMultipleBuildExceptions(MultipleBuildFailures multipleFailures) {
List<? extends Throwable> causes = multipleFailures.getCauses();
StyledTextOutput output = textOutputFactory.create(BuildExceptionReporter.class, LogLevel.ERROR);
output.println();
output.withStyle(Failure).format("FAILURE: Build completed with %s failures.", causes.size());
output.println();
for (int i = 0; i < causes.size(); i++) {
Throwable cause = causes.get(i);
FailureDetails details = constructFailureDetails("Task", cause);
output.println();
output.withStyle(Failure).format("%s: ", i + 1);
details.summary.writeTo(output.withStyle(Failure));
output.println();
output.text("-----------");
writeFailureDetails(output, details);
output.println("==============================================================================");
}
}
Aggregations