Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor adjustment in the report of redhat version rates #326

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions domino/app/src/main/java/io/quarkus/domino/cli/Quarkus.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@ public Integer call() throws Exception {
final ArtifactSet tracePattern = initTracePattern();
final Map<ArtifactCoords, List<MemberReport>> rootsToMembers = tracePattern == null ? Map.of() : new HashMap<>();
final Map<ArtifactCoords, ArtifactCoords> allNodes = redhatVersionRate ? new ConcurrentHashMap<>() : null;
final AtomicInteger redhatVersionsTotal = new AtomicInteger();
var treeVisitor = initTreeVisitor(tracePattern, allNodes, redhatVersionsTotal, memberReports, coreReport,
final AtomicInteger inspectedRoots = new AtomicInteger();
final AtomicInteger redhatVersions = new AtomicInteger();
var treeVisitor = initTreeVisitor(tracePattern, allNodes, redhatVersions, inspectedRoots, memberReports, coreReport,
rootsToMembers);
var treeInspector = initTreeInspector(resolver, treeVisitor);
var coreConstraints = readBomConstraints(platform.getCore().getBom(), resolver);
Expand Down Expand Up @@ -248,10 +249,11 @@ public Integer call() throws Exception {
logMemberReports(memberReports);

if (allNodes != null) {
log.info("Total number of dependencies: " + allNodes.size());
log.info(String.format("%-32s: %s", "Number of root artifacts", inspectedRoots));
log.info(String.format("%-32s: %s", "Total number of artifacts", allNodes.size()));
if (!allNodes.isEmpty()) {
log.info(String.format("Red Hat version rate: %.1f%%",
((double) redhatVersionsTotal.get() * 100) / allNodes.size()));
log.info(String.format("%-32s: %s (%.1f%%)", "Artifacts with Red Hat versions",
redhatVersions, ((double) redhatVersions.get() * 100) / allNodes.size()));
}
log.info("");
}
Expand All @@ -260,16 +262,18 @@ public Integer call() throws Exception {
}

private DependencyTreeVisitor<TreeNode> initTreeVisitor(ArtifactSet tracePattern,
Map<ArtifactCoords, ArtifactCoords> allNodes, AtomicInteger redhatVersionsTotal,
Map<ArtifactCoords, ArtifactCoords> allNodes,
AtomicInteger redhatVersionsTotal, AtomicInteger inspectedRoots,
ArrayList<MemberReport> memberReports, MemberReport coreReport,
Map<ArtifactCoords, List<MemberReport>> rootsToMembers) {
var treeVisitor = new DependencyTreeVisitor<TreeNode>() {
return new DependencyTreeVisitor<>() {

final Map<Artifact, String> enforcedBy = new HashMap<>();

@Override
public void visit(DependencyTreeVisit<TreeNode> visit) {
if (tracePattern != null || redhatVersionRate) {
inspectedRoots.incrementAndGet();
var result = visit(visit, visit.getRoot());
if (result != null) {
visit.pushEvent(result);
Expand Down Expand Up @@ -341,7 +345,6 @@ public void onEvent(TreeNode root, MessageWriter log) {
public void handleResolutionFailures(Collection<DependencyTreeError> requests) {
}
};
return treeVisitor;
}

private void logMemberReports(ArrayList<MemberReport> memberReports) {
Expand Down
Loading