Search in sources :

Example 1 with ArtifactProblem

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);
}
Also used : ArtifactProblem(com.google.cloud.tools.opensource.dependencies.ArtifactProblem) Artifact(org.eclipse.aether.artifact.Artifact) DependencyGraphBuilder(com.google.cloud.tools.opensource.dependencies.DependencyGraphBuilder)

Aggregations

ArtifactProblem (com.google.cloud.tools.opensource.dependencies.ArtifactProblem)1 DependencyGraphBuilder (com.google.cloud.tools.opensource.dependencies.DependencyGraphBuilder)1 Artifact (org.eclipse.aether.artifact.Artifact)1