in dashboard/src/main/java/com/google/cloud/tools/opensource/dashboard/DashboardMain.java [278:324]
static List<ArtifactResults> generateReports(
Configuration configuration,
Path output,
ArtifactCache cache,
ImmutableMap<ClassPathEntry, ImmutableSet<LinkageProblem>> linkageProblemTable,
ClassPathResult classPathResult,
Bom bom)
throws TemplateException {
Map<Artifact, ArtifactInfo> artifacts = cache.getInfoMap();
List<ArtifactResults> table = new ArrayList<>();
for (Entry<Artifact, ArtifactInfo> entry : artifacts.entrySet()) {
ArtifactInfo info = entry.getValue();
try {
if (info.getException() != null) {
ArtifactResults unavailable = new ArtifactResults(entry.getKey());
unavailable.setExceptionMessage(info.getException().getMessage());
table.add(unavailable);
} else {
Artifact artifact = entry.getKey();
ImmutableSet<ClassPathEntry> jarsInDependencyTree =
classPathResult.getClassPathEntries(Artifacts.toCoordinates(artifact));
Map<ClassPathEntry, ImmutableSet<LinkageProblem>> relevantLinkageProblemTable =
Maps.filterKeys(linkageProblemTable, jarsInDependencyTree::contains);
ArtifactResults results =
generateArtifactReport(
configuration,
output,
artifact,
entry.getValue(),
cache.getGlobalDependencies(),
ImmutableMap.copyOf(relevantLinkageProblemTable),
classPathResult,
bom);
table.add(results);
}
} catch (IOException ex) {
ArtifactResults unavailableTestResult = new ArtifactResults(entry.getKey());
unavailableTestResult.setExceptionMessage(ex.getMessage());
// Even when there's a problem generating test result, show the error in the dashboard
table.add(unavailableTestResult);
}
}
return table;
}