Java 类org.gradle.api.artifacts.ResolvedDependency 实例源码

项目:ARCHIVE-wildfly-swarm    文件:GradleArtifactResolvingHelper.java   
@Override
public ArtifactSpec resolve(final ArtifactSpec spec) {
    if (spec.file != null) {
        return spec;
    }

    final Iterator<ResolvedDependency> iterator =
            doResolve(new HashSet<>(Collections.singletonList(spec))).iterator();
    if (iterator.hasNext()) {
        spec.file = iterator.next()
                .getModuleArtifacts()
                .iterator().next()
                .getFile();

        return spec;
    }

    return null;
}
项目:ARCHIVE-wildfly-swarm    文件:GradleArtifactResolvingHelper.java   
private Set<ResolvedDependency> doResolve(final Collection<ArtifactSpec> deps) {
    final Configuration config = this.project.getConfigurations().detachedConfiguration();
    final DependencySet dependencySet = config.getDependencies();

    deps.forEach(spec -> {
        final DefaultExternalModuleDependency d =
                new DefaultExternalModuleDependency(spec.groupId(), spec.artifactId(), spec.version());
        final DefaultDependencyArtifact da =
                new DefaultDependencyArtifact(spec.artifactId(), spec.type(), spec.type(), spec.classifier(), null);
        d.addArtifact(da);
        d.getExcludeRules().add(new DefaultExcludeRule());
        dependencySet.add(d);
    });

    return config.getResolvedConfiguration().getFirstLevelModuleDependencies();
}
项目:Reer    文件:DefaultLenientConfiguration.java   
public Set<ResolvedDependency> getFirstLevelModuleDependencies(Spec<? super Dependency> dependencySpec) {
    Set<ResolvedDependency> matches = new LinkedHashSet<ResolvedDependency>();
    for (DependencyGraphNodeResult node : getFirstLevelNodes(dependencySpec)) {
        matches.add(node.getPublicView());
    }
    return matches;
}
项目:Reer    文件:DefaultLenientConfiguration.java   
public Set<ResolvedDependency> getAllModuleDependencies() {
    Set<ResolvedDependency> resolvedElements = new LinkedHashSet<ResolvedDependency>();
    Deque<ResolvedDependency> workQueue = new LinkedList<ResolvedDependency>();
    workQueue.addAll(loadTransientGraphResults(selectedArtifacts).getRootNode().getPublicView().getChildren());
    while (!workQueue.isEmpty()) {
        ResolvedDependency item = workQueue.removeFirst();
        if (resolvedElements.add(item)) {
            final Set<ResolvedDependency> children = item.getChildren();
            if (children != null) {
                workQueue.addAll(children);
            }
        }
    }
    return resolvedElements;
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
@Override
public Set<ResolvedDependency> getFirstLevelModuleDependencies() {
    try {
        return lenientConfiguration.getFirstLevelModuleDependencies();
    } catch (Throwable e) {
        throw wrapException(e, resolveContext);
    }
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
@Override
public Set<ResolvedDependency> getFirstLevelModuleDependencies(Spec<? super Dependency> dependencySpec) {
    try {
        return lenientConfiguration.getFirstLevelModuleDependencies(dependencySpec);
    } catch (Throwable e) {
        throw wrapException(e, resolveContext);
    }
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
@Override
public Set<ResolvedDependency> getAllModuleDependencies() {
    try {
        return lenientConfiguration.getAllModuleDependencies();
    } catch (Throwable e) {
        throw wrapException(e, resolveContext);
    }
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
public Set<ResolvedDependency> getFirstLevelModuleDependencies() throws ResolveException {
    try {
        return resolvedConfiguration.getFirstLevelModuleDependencies();
    } catch (Throwable e) {
        throw wrapException(e, configuration);
    }
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
public Set<ResolvedDependency> getFirstLevelModuleDependencies(Spec<? super Dependency> dependencySpec) throws ResolveException {
    try {
        return resolvedConfiguration.getFirstLevelModuleDependencies(dependencySpec);
    } catch (Throwable e) {
        throw wrapException(e, configuration);
    }
}
项目:Reer    文件:DefaultResolvedDependency.java   
public Set<ResolvedArtifact> getAllModuleArtifacts() {
    if (allModuleArtifactsCache == null) {
        Set<ResolvedArtifact> allArtifacts = new LinkedHashSet<ResolvedArtifact>();
        allArtifacts.addAll(getModuleArtifacts());
        for (ResolvedDependency childResolvedDependency : getChildren()) {
            allArtifacts.addAll(childResolvedDependency.getAllModuleArtifacts());
        }
        allModuleArtifactsCache = allArtifacts;
    }
    return allModuleArtifactsCache;
}
项目:Reer    文件:DefaultResolvedDependency.java   
@Override
public ResolvedArtifactSet getArtifactsForIncomingEdge(DependencyGraphNodeResult parent) {
    if (!parents.contains(parent)) {
        throw new InvalidUserDataException("Provided dependency (" + parent + ") must be a parent of: " + this);
    }
    return CompositeArtifactSet.of(parentArtifacts.get((ResolvedDependency) parent));
}
项目:Reer    文件:DefaultResolvedDependency.java   
public Set<ResolvedArtifact> getAllArtifacts(ResolvedDependency parent) {
    if (allArtifactsCache.get(parent) == null) {
        Set<ResolvedArtifact> allArtifacts = new LinkedHashSet<ResolvedArtifact>();
        allArtifacts.addAll(getArtifacts(parent));
        for (ResolvedDependency childResolvedDependency : getChildren()) {
            for (ResolvedDependency childParent : childResolvedDependency.getParents()) {
                allArtifacts.addAll(childResolvedDependency.getAllArtifacts(childParent));
            }
        }
        allArtifactsCache.put(parent, allArtifacts);
    }
    return allArtifactsCache.get(parent);
}
项目:ossindex-gradle-plugin    文件:GradleArtifact.java   
public GradleArtifact(GradleArtifact parent, ResolvedDependency gradleArtifact) {
    this.parent = parent;
    children = new HashSet<>();
    name = gradleArtifact.getModule().getId().getName();
    group = gradleArtifact.getModule().getId().getGroup();
    version = gradleArtifact.getModule().getId().getVersion();
    addChildren(gradleArtifact);
}
项目:ossindex-gradle-plugin    文件:GradleArtifact.java   
private void addChildren(ResolvedDependency gradleArtifact) {
    gradleArtifact.getChildren().forEach(c -> {
                GradleArtifact child = new GradleArtifact(this, c);
                children.add(child);
            }
    );
}
项目:Pushjet-Android    文件:DefaultResolvedDependency.java   
public Set<ResolvedArtifact> getAllModuleArtifacts() {
    if (allModuleArtifactsCache == null) {
        Set<ResolvedArtifact> allArtifacts = new LinkedHashSet<ResolvedArtifact>();
        allArtifacts.addAll(getModuleArtifacts());
        for (ResolvedDependency childResolvedDependency : getChildren()) {
            allArtifacts.addAll(childResolvedDependency.getAllModuleArtifacts());
        }
        allModuleArtifactsCache = allArtifacts;
    }
    return allModuleArtifactsCache;
}
项目:Pushjet-Android    文件:DefaultResolvedDependency.java   
public Set<ResolvedArtifact> getParentArtifacts(ResolvedDependency parent) {
    if (!parents.contains(parent)) {
        throw new InvalidUserDataException("Provided dependency (" + parent + ") must be a parent of: " + this);
    }
    Set<ResolvedArtifact> artifacts = parentArtifacts.get(parent);
    return artifacts == null ? Collections.<ResolvedArtifact>emptySet() : artifacts;
}
项目:Pushjet-Android    文件:DefaultResolvedDependency.java   
public Set<ResolvedArtifact> getAllArtifacts(ResolvedDependency parent) {
    if (allArtifactsCache.get(parent) == null) {
        Set<ResolvedArtifact> allArtifacts = new LinkedHashSet<ResolvedArtifact>();
        allArtifacts.addAll(getArtifacts(parent));
        for (ResolvedDependency childResolvedDependency : getChildren()) {
            for (ResolvedDependency childParent : childResolvedDependency.getParents()) {
                allArtifacts.addAll(childResolvedDependency.getAllArtifacts(childParent));
            }
        }
        allArtifactsCache.put(parent, allArtifacts);
    }
    return allArtifactsCache.get(parent);
}
项目:Pushjet-Android    文件:DefaultResolvedDependency.java   
public void addParentSpecificArtifacts(ResolvedDependency parent, Set<ResolvedArtifact> artifacts) {
    Set<ResolvedArtifact> parentArtifacts = this.parentArtifacts.get(parent);
    if (parentArtifacts == null) {
        parentArtifacts = new TreeSet<ResolvedArtifact>(new ResolvedArtifactComparator());
        this.parentArtifacts.put(parent, parentArtifacts);
    }
    parentArtifacts.addAll(artifacts);
    moduleArtifacts.addAll(artifacts);
}
项目:Pushjet-Android    文件:DefaultResolvedArtifact.java   
public DefaultResolvedArtifact(ResolvedModuleVersion owner, Factory<ResolvedDependency> ownerSource, IvyArtifactName artifact, Factory<File> artifactSource, long id) {
    this.ownerSource = ownerSource;
    this.owner = owner;
    this.artifact = artifact;
    this.id = id;
    this.artifactSource = artifactSource;
}
项目:Pushjet-Android    文件:DefaultResolvedArtifact.java   
public ResolvedDependency getResolvedDependency() {
    DeprecationLogger.nagUserOfDeprecated(
            "ResolvedArtifact.getResolvedDependency()",
            "For version info use ResolvedArtifact.getModuleVersion(), to access the dependency graph use ResolvedConfiguration.getFirstLevelModuleDependencies()"
    );
    //resolvedDependency is expensive so lazily create it
    return ownerSource.create();
}
项目:Pushjet-Android    文件:DefaultResolvedDependency.java   
public Set<ResolvedArtifact> getAllModuleArtifacts() {
    if (allModuleArtifactsCache == null) {
        Set<ResolvedArtifact> allArtifacts = new LinkedHashSet<ResolvedArtifact>();
        allArtifacts.addAll(getModuleArtifacts());
        for (ResolvedDependency childResolvedDependency : getChildren()) {
            allArtifacts.addAll(childResolvedDependency.getAllModuleArtifacts());
        }
        allModuleArtifactsCache = allArtifacts;
    }
    return allModuleArtifactsCache;
}
项目:Pushjet-Android    文件:DefaultResolvedDependency.java   
public Set<ResolvedArtifact> getParentArtifacts(ResolvedDependency parent) {
    if (!parents.contains(parent)) {
        throw new InvalidUserDataException("Provided dependency (" + parent + ") must be a parent of: " + this);
    }
    Set<ResolvedArtifact> artifacts = parentArtifacts.get(parent);
    return artifacts == null ? Collections.<ResolvedArtifact>emptySet() : artifacts;
}
项目:Pushjet-Android    文件:DefaultResolvedDependency.java   
public Set<ResolvedArtifact> getAllArtifacts(ResolvedDependency parent) {
    if (allArtifactsCache.get(parent) == null) {
        Set<ResolvedArtifact> allArtifacts = new LinkedHashSet<ResolvedArtifact>();
        allArtifacts.addAll(getArtifacts(parent));
        for (ResolvedDependency childResolvedDependency : getChildren()) {
            for (ResolvedDependency childParent : childResolvedDependency.getParents()) {
                allArtifacts.addAll(childResolvedDependency.getAllArtifacts(childParent));
            }
        }
        allArtifactsCache.put(parent, allArtifacts);
    }
    return allArtifactsCache.get(parent);
}
项目:Pushjet-Android    文件:DefaultResolvedDependency.java   
public void addParentSpecificArtifacts(ResolvedDependency parent, Set<ResolvedArtifact> artifacts) {
    Set<ResolvedArtifact> parentArtifacts = this.parentArtifacts.get(parent);
    if (parentArtifacts == null) {
        parentArtifacts = new TreeSet<ResolvedArtifact>(new ResolvedArtifactComparator());
        this.parentArtifacts.put(parent, parentArtifacts);
    }
    parentArtifacts.addAll(artifacts);
    moduleArtifacts.addAll(artifacts);
}
项目:ARCHIVE-wildfly-swarm    文件:PackageTask.java   
private void walk(final boolean top, ResolvedDependency dep) {
    Set<ResolvedArtifact> artifacts = dep.getModuleArtifacts();
    for (ResolvedArtifact each : artifacts) {
        String[] parts = dep.getName().split(":");
        String groupId = parts[0];
        String artifactId = parts[1];
        String version = parts[2];
        this.tool.dependency("compile", groupId, artifactId, version, each.getExtension(),
                             each.getClassifier(), each.getFile(), top);
    }

    dep.getChildren().forEach(d -> walk(false, d));
}
项目:checkstyle-addons    文件:CreateFatJarTask.java   
protected static Set<String> getNonCheckstyleDeps(final Configuration pConfiguration)
{
    Set<String> result = new HashSet<>();
    for (ResolvedDependency dep : pConfiguration.getResolvedConfiguration().getFirstLevelModuleDependencies()) {
        if (!CreateJarEclipseTask.isCheckstyle(dep)) {
            result.add(dep.getName());
            for (final ResolvedDependency rd : dep.getChildren()) {
                result.add(rd.getName());
            }
        }
    }
    return result;
}
项目:checkstyle-addons    文件:CreateJarEclipseTask.java   
/**
 * Scan the dependencies of the specified configurations and return a list of File objects for each dependency.
 * Resolves the configurations if they are still unresolved.
 *
 * @param pTask the calling task
 * @param pDepConfig the current dependency configuration
 * @return list of files
 */
public static Set<File> getPublishedDependencyLibs(@Nonnull final Task pTask,
    @Nonnull final DependencyConfig pDepConfig)
{
    Set<File> result = new HashSet<>();
    Configuration cfg = new ClasspathBuilder(pTask.getProject()).buildMainRuntimeConfiguration(pDepConfig);
    for (ResolvedDependency dep : cfg.getResolvedConfiguration().getFirstLevelModuleDependencies()) {
        if (!isCheckstyle(dep)) {
            for (ResolvedArtifact artifact : dep.getAllModuleArtifacts()) {
                result.add(artifact.getFile());
            }
        }
    }
    return result;
}
项目:japicmp-gradle-plugin    文件:JapicmpTask.java   
private List<JApiCmpWorkerAction.Archive> inferArchives(FileCollection fc) {
    if (fc instanceof Configuration) {
        final List<JApiCmpWorkerAction.Archive> archives = new ArrayList<>();
        Set<ResolvedDependency> firstLevelModuleDependencies = ((Configuration) fc).getResolvedConfiguration().getFirstLevelModuleDependencies();
        for (ResolvedDependency moduleDependency : firstLevelModuleDependencies) {
            collectArchives(archives, moduleDependency);
        }
        return archives;
    }

    return toArchives(fc);
}
项目:japicmp-gradle-plugin    文件:JapicmpTask.java   
private void collectArchives(final List<JApiCmpWorkerAction.Archive> archives, ResolvedDependency resolvedDependency) {
    String version = resolvedDependency.getModule().getId().getVersion();
    archives.add(new JApiCmpWorkerAction.Archive(resolvedDependency.getAllModuleArtifacts().iterator().next().getFile(), version));
    for (ResolvedDependency dependency : resolvedDependency.getChildren()) {
        collectArchives(archives, dependency);
    }
}
项目:Reer    文件:DefaultLenientConfiguration.java   
public Set<ResolvedDependency> getFirstLevelModuleDependencies() {
    return loadTransientGraphResults(selectedArtifacts).getRootNode().getPublicView().getChildren();
}
项目:Reer    文件:ShortCircuitEmptyConfigurationResolver.java   
@Override
public Set<ResolvedDependency> getFirstLevelModuleDependencies() {
    return Collections.emptySet();
}
项目:Reer    文件:ShortCircuitEmptyConfigurationResolver.java   
@Override
public Set<ResolvedDependency> getFirstLevelModuleDependencies(Spec<? super Dependency> dependencySpec) throws ResolveException {
    return Collections.emptySet();
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
@Override
public Set<ResolvedDependency> getFirstLevelModuleDependencies() throws ResolveException {
    throw wrapException(e, configuration);
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
@Override
public Set<ResolvedDependency> getFirstLevelModuleDependencies(Spec<? super Dependency> dependencySpec) throws ResolveException {
    throw wrapException(e, configuration);
}
项目:Reer    文件:DefaultResolvedConfiguration.java   
public Set<ResolvedDependency> getFirstLevelModuleDependencies() throws ResolveException {
    rethrowFailure();
    return configuration.getFirstLevelModuleDependencies();
}
项目:Reer    文件:DefaultResolvedConfiguration.java   
public Set<ResolvedDependency> getFirstLevelModuleDependencies(Spec<? super Dependency> dependencySpec) throws ResolveException {
    rethrowFailure();
    return configuration.getFirstLevelModuleDependencies(dependencySpec);
}
项目:Reer    文件:DefaultResolvedDependency.java   
@Override
public ResolvedDependency getPublicView() {
    return this;
}
项目:Reer    文件:DefaultResolvedDependency.java   
public Set<ResolvedDependency> getChildren() {
    return ImmutableSet.<ResolvedDependency>copyOf(children);
}
项目:Reer    文件:DefaultResolvedDependency.java   
public Set<ResolvedArtifact> getParentArtifacts(ResolvedDependency parent) {
    return sort(getArtifactsForIncomingEdge((DependencyGraphNodeResult) parent));
}
项目:Reer    文件:DefaultResolvedDependency.java   
public Set<ResolvedArtifact> getArtifacts(ResolvedDependency parent) {
    return getParentArtifacts(parent);
}