use of org.gradle.problems.Solution in project gradle by gradle.
the class TypeValidationProblemRenderer method renderMinimalInformationAbout.
public static String renderMinimalInformationAbout(TypeValidationProblem problem, boolean renderDocLink, boolean renderSolutions) {
TreeFormatter formatter = new TreeFormatter();
formatter.node(introductionFor(problem.getWhere()) + maybeAppendDot(problem.getShortDescription()));
problem.getWhy().ifPresent(reason -> {
formatter.blankLine();
formatter.node("Reason: " + StringUtils.capitalize(maybeAppendDot(reason)));
});
if (renderSolutions) {
List<Solution> possibleSolutions = problem.getPossibleSolutions();
int solutionCount = possibleSolutions.size();
if (solutionCount > 0) {
formatter.blankLine();
if (solutionCount == 1) {
formatter.node("Possible solution: " + StringUtils.capitalize(maybeAppendDot(possibleSolutions.get(0).getShortDescription())));
} else {
formatter.node("Possible solutions");
formatter.startNumberedChildren();
possibleSolutions.forEach(solution -> formatter.node(StringUtils.capitalize(maybeAppendDot(solution.getShortDescription()))));
formatter.endChildren();
}
}
}
if (renderDocLink) {
problem.getDocumentationLink().ifPresent(docLink -> {
formatter.blankLine();
formatter.node("Please refer to ").append(docLink).append(" for more details about this problem.");
});
}
return formatter.toString();
}
use of org.gradle.problems.Solution 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