use of org.gradle.internal.logging.text.TreeFormatter in project gradle by gradle.
the class DefaultVariantTransformRegistry method registerTransform.
@Override
public <T extends TransformParameters> void registerTransform(Class<? extends TransformAction<T>> actionType, Action<? super TransformSpec<T>> registrationAction) {
try {
Class<T> parameterType = isolationScheme.parameterTypeFor(actionType);
T parameterObject = parameterType == null ? null : parametersInstantiationScheme.withServices(services).instantiator().newInstance(parameterType);
TypedRegistration<T> registration = Cast.uncheckedNonnullCast(instantiatorFactory.decorateLenient().newInstance(TypedRegistration.class, parameterObject, immutableAttributesFactory));
registrationAction.execute(registration);
register(registration, actionType, parameterObject);
} catch (VariantTransformConfigurationException e) {
throw e;
} catch (Exception e) {
TreeFormatter formatter = new TreeFormatter();
formatter.node("Could not register artifact transform ");
formatter.appendType(actionType);
formatter.append(".");
throw new VariantTransformConfigurationException(formatter.toString(), e);
}
}
use of org.gradle.internal.logging.text.TreeFormatter in project gradle by gradle.
the class SimpleGeneratedJavaClassCompiler method throwCompilationError.
private static void throwCompilationError(List<Diagnostic<? extends JavaFileObject>> diagnostics) {
TreeFormatter formatter = new TreeFormatter();
formatter.node("Unable to compile generated sources");
formatter.startChildren();
for (Diagnostic<? extends JavaFileObject> d : diagnostics) {
JavaFileObject source = d.getSource();
String srcFile = source == null ? "unknown" : new File(source.toUri()).getName();
String diagLine = String.format("File %s, line: %d, %s", srcFile, d.getLineNumber(), d.getMessage(null));
formatter.node(diagLine);
}
formatter.endChildren();
throw new GeneratedClassCompilationException(formatter.toString());
}
use of org.gradle.internal.logging.text.TreeFormatter in project gradle by gradle.
the class IncompatibleConfigurationSelectionException method generateMessage.
private static String generateMessage(AttributeContainerInternal fromConfigurationAttributes, AttributeMatcher attributeMatcher, ComponentResolveMetadata targetComponent, String targetConfiguration, boolean variantAware, AttributeDescriber describer) {
TreeFormatter formatter = new TreeFormatter();
formatter.node((variantAware ? "Variant '" : "Configuration '") + targetConfiguration + "' in " + style(StyledTextOutput.Style.Info, targetComponent.getId().getDisplayName()) + " does not match the consumer attributes");
formatConfiguration(formatter, targetComponent, fromConfigurationAttributes, attributeMatcher, targetComponent.getConfiguration(targetConfiguration), variantAware, false, describer);
return formatter.toString();
}
use of org.gradle.internal.logging.text.TreeFormatter in project gradle by gradle.
the class DependencyInsightReporter method collectErrorMessages.
private static String collectErrorMessages(Throwable failure, Set<Throwable> alreadyReportedErrors) {
TreeFormatter formatter = new TreeFormatter();
collectErrorMessages(failure, formatter, alreadyReportedErrors);
return formatter.toString();
}
use of org.gradle.internal.logging.text.TreeFormatter in project gradle by gradle.
the class VersionCatalogProblem method reportInto.
public void reportInto(TreeFormatter output) {
TreeFormatter formatter = new TreeFormatter();
formatter.node("Problem: In " + uncapitalize(getWhere()) + ", " + maybeAppendDot(uncapitalize(getShortDescription())));
getWhy().ifPresent(reason -> {
formatter.blankLine();
formatter.node("Reason: " + capitalize(maybeAppendDot(reason)));
});
List<Solution> possibleSolutions = getPossibleSolutions();
int solutionCount = possibleSolutions.size();
if (solutionCount > 0) {
formatter.blankLine();
if (solutionCount == 1) {
formatter.node("Possible solution: " + capitalize(maybeAppendDot(possibleSolutions.get(0).getShortDescription())));
} else {
formatter.node("Possible solutions");
formatter.startNumberedChildren();
possibleSolutions.forEach(solution -> formatter.node(capitalize(maybeAppendDot(solution.getShortDescription()))));
formatter.endChildren();
}
}
getDocumentationLink().ifPresent(docLink -> {
formatter.blankLine();
formatter.node("Please refer to ").append(docLink).append(" for more details about this problem.");
});
output.node(formatter.toString());
}
Aggregations