use of com.google.cloud.tools.opensource.dependencies.ArtifactProblem in project cloud-opensource-java by GoogleCloudPlatform.
the class LinkageCheckerMain method checkArtifacts.
private static Problems checkArtifacts(LinkageCheckerArguments linkageCheckerArguments) throws IOException, RepositoryException, TransformerException, XMLStreamException {
ImmutableList<Artifact> artifacts = linkageCheckerArguments.getArtifacts();
// When a BOM or Maven artifacts are passed as arguments, resolve the dependencies.
DependencyGraphBuilder dependencyGraphBuilder = new DependencyGraphBuilder(linkageCheckerArguments.getMavenRepositoryUrls());
ClassPathBuilder classPathBuilder = new ClassPathBuilder(dependencyGraphBuilder);
ClassPathResult classPathResult = classPathBuilder.resolve(artifacts, false, DependencyMediation.MAVEN);
ImmutableList<ClassPathEntry> inputClassPath = classPathResult.getClassPath();
ImmutableList<ArtifactProblem> artifactProblems = ImmutableList.copyOf(classPathResult.getArtifactProblems());
ImmutableSet<ClassPathEntry> entryPoints = ImmutableSet.copyOf(inputClassPath.subList(0, artifacts.size()));
LinkageChecker linkageChecker = LinkageChecker.create(inputClassPath, entryPoints, linkageCheckerArguments.getInputExclusionFile());
ImmutableSet<LinkageProblem> linkageProblems = findLinkageProblems(linkageChecker, linkageCheckerArguments.getReportOnlyReachable());
LinkageProblemCauseAnnotator.annotate(classPathBuilder, classPathResult, linkageProblems);
return new Problems(linkageProblems, artifactProblems, classPathResult);
}
Aggregations