Java Code Examples for org.apache.ivy.core.resolve.IvyNode#isCompletelyEvicted()

The following examples show how to use org.apache.ivy.core.resolve.IvyNode#isCompletelyEvicted() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IvyInternalDepResolver.java    From jeka with Apache License 2.0 6 votes vote down vote up
private List<JkModuleDepProblem> moduleProblems(List<IvyNode> ivyNodes) {
    final List<JkModuleDepProblem> result = new LinkedList<>();
    for (final IvyNode ivyNode : ivyNodes) {
        if (ivyNode.isCompletelyBlacklisted() || ivyNode.isCompletelyEvicted()) {
            continue;
        }
        if (ivyNode.hasProblem()) {
            final JkModuleId jkModuleId = JkModuleId.of(ivyNode.getModuleId().getOrganisation(), ivyNode.getModuleId().getName());
            final JkModuleDepProblem problem = JkModuleDepProblem.of(jkModuleId,
                    ivyNode.getId().getRevision(),
                    ivyNode.getProblemMessage());
            result.add(problem);
        }
    }
    return result;
}
 
Example 2
Source File: ResolveReport.java    From ant-ivy with Apache License 2.0 6 votes vote down vote up
public void setDependencies(List<IvyNode> dependencies, Filter<Artifact> artifactFilter) {
    this.dependencies = dependencies;
    // collect list of artifacts
    artifacts = new ArrayList<>();
    for (IvyNode dependency : dependencies) {
        if (!dependency.isCompletelyEvicted() && !dependency.hasProblem()) {
            artifacts.addAll(Arrays.asList(dependency.getSelectedArtifacts(artifactFilter)));
        }
        // update the configurations reports with the dependencies
        // these reports will be completed later with download information, if any
        for (String dconf : dependency.getRootModuleConfigurations()) {
            ConfigurationResolveReport configurationReport = getConfigurationReport(dconf);
            if (configurationReport != null) {
                configurationReport.addDependency(dependency);
            }
        }
    }
}
 
Example 3
Source File: IvyInternalDepResolver.java    From jeka with Apache License 2.0 5 votes vote down vote up
IvyTreeResolver(Iterable<IvyNode> nodes, IvyArtifactContainer artifactContainer) {


            for (final IvyNode node : nodes) {
                if (node.isCompletelyBlacklisted()) {
                    continue;
                }
                final JkModuleId moduleId = JkModuleId.of(node.getId().getOrganisation(), node.getId().getName());
                final JkVersion resolvedVersion = JkVersion.of(node.getResolvedId().getRevision());
                final Set<JkScope> rootScopes = IvyTranslations.toJkScopes(node.getRootModuleConfigurations());

                List<Path> artifacts;
                if (!node.isCompletelyEvicted()) {
                    artifacts = artifactContainer.getArtifacts(moduleId.withVersion(resolvedVersion.getValue()));
                } else {
                    artifacts = new LinkedList<>();
                }

                final Caller[] callers = node.getAllCallers();
                for (final Caller caller : callers) {
                    final JkVersionedModule parent = IvyTranslations.toJkVersionedModule(caller.getModuleRevisionId());
                    final List<JkModuleNodeInfo> list = parentChildMap.computeIfAbsent(parent.getModuleId(), k -> new LinkedList<>());
                    final DependencyDescriptor dependencyDescriptor = caller.getDependencyDescriptor();
                    final Set<JkScope> declaredScopes = IvyTranslations.toJkScopes(dependencyDescriptor.getModuleConfigurations());
                    final JkVersion version = JkVersion.of(dependencyDescriptor
                            .getDynamicConstraintDependencyRevisionId().getRevision());
                    final JkModuleNodeInfo moduleNodeInfo  = JkModuleNodeInfo.of(moduleId, version, declaredScopes,
                            rootScopes, resolvedVersion, artifacts);
                    if (!containSame(list, moduleId)) {
                        list.add(moduleNodeInfo);
                    }
                }
            }
        }
 
Example 4
Source File: IvyArtifactReport.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
private void generateXml(IvyNode[] dependencies,
                         Map<ModuleRevisionId, Set<ArtifactDownloadReport>> moduleRevToArtifactsMap,
                         Map<ArtifactDownloadReport, Set<String>> artifactsToCopy) {
    try {
        try (FileOutputStream fileOutputStream = new FileOutputStream(tofile)) {
            TransformerHandler saxHandler = createTransformerHandler(fileOutputStream);

            saxHandler.startDocument();
            saxHandler.startElement(null, "modules", "modules", new AttributesImpl());

            for (IvyNode dependency : dependencies) {
                if (dependency.getModuleRevision() == null
                        || dependency.isCompletelyEvicted()) {
                    continue;
                }

                startModule(saxHandler, dependency);

                Set<ArtifactDownloadReport> artifactsOfModuleRev = moduleRevToArtifactsMap.get(dependency
                        .getModuleRevision().getId());
                if (artifactsOfModuleRev != null) {
                    for (ArtifactDownloadReport artifact : artifactsOfModuleRev) {

                        RepositoryCacheManager cache = dependency.getModuleRevision()
                                .getArtifactResolver().getRepositoryCacheManager();

                        startArtifact(saxHandler, artifact.getArtifact());

                        writeOriginLocationIfPresent(cache, saxHandler, artifact);
                        writeCacheLocationIfPresent(cache, saxHandler, artifact);

                        for (String artifactDestPath : artifactsToCopy.get(artifact)) {
                            writeRetrieveLocation(saxHandler, artifactDestPath);
                        }
                        saxHandler.endElement(null, "artifact", "artifact");
                    }
                }
                saxHandler.endElement(null, "module", "module");
            }
            saxHandler.endElement(null, "modules", "modules");
            saxHandler.endDocument();
        }
    } catch (SAXException | IOException | TransformerConfigurationException e) {
        throw new BuildException("impossible to generate report", e);
    }
}