Java 类org.gradle.api.artifacts.result.ResolvedComponentResult 实例源码

项目:Reer    文件:StreamingResolutionResultBuilder.java   
public ResolvedComponentResult create() {
    synchronized (lock) {
        return cache.load(new Factory<ResolvedComponentResult>() {
            public ResolvedComponentResult create() {
                try {
                    return data.read(new BinaryStore.ReadAction<ResolvedComponentResult>() {
                        public ResolvedComponentResult read(Decoder decoder) throws IOException {
                            return deserialize(decoder);
                        }
                    });
                } finally {
                    try {
                        data.close();
                    } catch (IOException e) {
                        throw throwAsUncheckedException(e);
                    }
                }
            }
        });
    }
}
项目:Reer    文件:ResolutionResultsStoreFactory.java   
public StoreSet createStoreSet() {
    return new StoreSet() {
        int storeSetId = storeSetBaseId.getAndIncrement();
        int binaryStoreId;
        public DefaultBinaryStore nextBinaryStore() {
            //one binary store per id+threadId
            String storeKey = Thread.currentThread().getId() + "-" + binaryStoreId++;
            return createBinaryStore(storeKey);
        }

        public Store<ResolvedComponentResult> newModelCache() {
            return getNewModelCache().createCachedStore(storeSetId);
        }

        public Store<TransientConfigurationResults> oldModelCache() {
            return getOldModelCache().createCachedStore(storeSetId);
        }
    };
}
项目:Reer    文件:DefaultIdeDependencyResolver.java   
/**
 * Gets IDE repository file dependencies.
 *
 * @param configuration Configuration
 * @return IDE repository file dependencies
 */
public List<IdeExtendedRepoFileDependency> getIdeRepoFileDependencies(Configuration configuration) {
    ResolutionResult result = getIncomingResolutionResult(configuration);
    final Set<ResolvedComponentResult> resolvedRepoFileComponents = CollectionUtils.filter(result.getAllComponents(), new Spec<ResolvedComponentResult>() {
        @Override
        public boolean isSatisfiedBy(ResolvedComponentResult element) {
            return element.getId() instanceof ModuleComponentIdentifier;
        }
    });
    Set<ModuleVersionIdentifier> mappedResolvedDependencies = mapResolvedDependencies(resolvedRepoFileComponents);
    Set<ResolvedArtifact> artifacts = getExternalArtifacts(configuration);
    List<IdeExtendedRepoFileDependency> externalDependencies = new ArrayList<IdeExtendedRepoFileDependency>();
    for (ResolvedArtifact artifact : artifacts) {
        if (mappedResolvedDependencies.contains(artifact.getModuleVersion().getId())) {
            IdeExtendedRepoFileDependency ideRepoFileDependency = new IdeExtendedRepoFileDependency(artifact.getFile());
            ideRepoFileDependency.setId(artifact.getModuleVersion().getId());
            externalDependencies.add(ideRepoFileDependency);
        }
    }

    return externalDependencies;
}
项目:Pushjet-Android    文件:StreamingResolutionResultBuilder.java   
public ResolvedComponentResult create() {
    synchronized (lock) {
        return cache.load(new Factory<ResolvedComponentResult>() {
            public ResolvedComponentResult create() {
                try {
                    return data.read(new BinaryStore.ReadAction<ResolvedComponentResult>() {
                        public ResolvedComponentResult read(Decoder decoder) throws IOException {
                            return deserialize(decoder);
                        }
                    });
                } finally {
                    try {
                        data.close();
                    } catch (IOException e) {
                        throw throwAsUncheckedException(e);
                    }
                }
            }
        });
    }
}
项目:Pushjet-Android    文件:StreamingResolutionResultBuilder.java   
public ResolvedComponentResult create() {
    synchronized (lock) {
        return cache.load(new Factory<ResolvedComponentResult>() {
            public ResolvedComponentResult create() {
                try {
                    return data.read(new BinaryStore.ReadAction<ResolvedComponentResult>() {
                        public ResolvedComponentResult read(Decoder decoder) throws IOException {
                            return deserialize(decoder);
                        }
                    });
                } finally {
                    try {
                        data.close();
                    } catch (IOException e) {
                        throw throwAsUncheckedException(e);
                    }
                }
            }
        });
    }
}
项目:Reer    文件:DefaultConfigurationResolver.java   
public void resolveGraph(ConfigurationInternal configuration, ResolverResults results) {
    List<ResolutionAwareRepository> resolutionAwareRepositories = CollectionUtils.collect(repositories, Transformers.cast(ResolutionAwareRepository.class));
    StoreSet stores = storeFactory.createStoreSet();

    BinaryStore oldModelStore = stores.nextBinaryStore();
    Store<TransientConfigurationResults> oldModelCache = stores.oldModelCache();
    TransientConfigurationResultsBuilder oldTransientModelBuilder = new TransientConfigurationResultsBuilder(oldModelStore, oldModelCache);
    DefaultResolvedConfigurationBuilder oldModelBuilder = new DefaultResolvedConfigurationBuilder(oldTransientModelBuilder);
    ResolvedConfigurationDependencyGraphVisitor oldModelVisitor = new ResolvedConfigurationDependencyGraphVisitor(oldModelBuilder);

    BinaryStore newModelStore = stores.nextBinaryStore();
    Store<ResolvedComponentResult> newModelCache = stores.newModelCache();
    StreamingResolutionResultBuilder newModelBuilder = new StreamingResolutionResultBuilder(newModelStore, newModelCache);

    ResolvedLocalComponentsResultGraphVisitor localComponentsVisitor = new ResolvedLocalComponentsResultGraphVisitor();

    DefaultResolvedArtifactsBuilder artifactsBuilder = new DefaultResolvedArtifactsBuilder(buildProjectDependencies);
    FileDependencyCollectingGraphVisitor fileDependencyVisitor = new FileDependencyCollectingGraphVisitor();

    DependencyGraphVisitor graphVisitor = new CompositeDependencyGraphVisitor(oldModelVisitor, newModelBuilder, localComponentsVisitor, fileDependencyVisitor);
    DependencyArtifactsVisitor artifactsVisitor = new CompositeDependencyArtifactsVisitor(oldModelVisitor, artifactsBuilder);

    resolver.resolve(configuration, resolutionAwareRepositories, metadataHandler, Specs.<DependencyMetadata>satisfyAll(), graphVisitor, artifactsVisitor, attributesSchema);

    ArtifactTransformer transformer = new ArtifactTransformer(configuration.getResolutionStrategy(), attributesSchema);
    VisitedArtifactsResults artifactsResults = artifactsBuilder.complete();
    results.graphResolved(newModelBuilder.complete(), localComponentsVisitor, new BuildDependenciesOnlyVisitedArtifactSet(artifactsResults, fileDependencyVisitor, transformer));

    results.retainState(new ArtifactResolveState(oldModelBuilder.complete(), artifactsResults, fileDependencyVisitor, oldTransientModelBuilder));
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
public ResolvedComponentResult getRoot() {
    try {
        return resolutionResult.getRoot();
    } catch (Throwable e) {
        throw wrapException(e, resolveContext);
    }
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
public Set<ResolvedComponentResult> getAllComponents() {
    try {
        return resolutionResult.getAllComponents();
    } catch (Throwable e) {
        throw wrapException(e, resolveContext);
    }
}
项目:Reer    文件:StreamingResolutionResultBuilder.java   
private ResolvedComponentResult deserialize(Decoder decoder) {
    int valuesRead = 0;
    byte type = -1;
    Timer clock = Timers.startTimer();
    try {
        DefaultResolutionResultBuilder builder = new DefaultResolutionResultBuilder();
        while (true) {
            type = decoder.readByte();
            valuesRead++;
            switch (type) {
                case ROOT:
                    // Last entry, complete the result
                    Long rootId = decoder.readSmallLong();
                    ResolvedComponentResult root = builder.complete(rootId).getRoot();
                    LOG.debug("Loaded resolution results ({}) from {}", clock.getElapsed(), data);
                    return root;
                case COMPONENT:
                    ComponentResult component = componentResultSerializer.read(decoder);
                    builder.visitComponent(component);
                    break;
                case DEPENDENCY:
                    Long fromId = decoder.readSmallLong();
                    int size = decoder.readSmallInt();
                    List<DependencyResult> deps = new ArrayList<DependencyResult>(size);
                    for (int i = 0; i < size; i++) {
                        deps.add(dependencyResultSerializer.read(decoder, failures));
                    }
                    builder.visitOutgoingEdges(fromId, deps);
                    break;
                default:
                    throw new IOException("Unknown value type read from stream: " + type);
            }
        }
    } catch (IOException e) {
        throw new RuntimeException("Problems loading the resolution results (" + clock.getElapsed() + "). "
                + "Read " + valuesRead + " values, last was: " + type, e);
    }
}
项目:Reer    文件:CachingDependencyResultFactory.java   
public UnresolvedDependencyResult createUnresolvedDependency(ComponentSelector requested, ResolvedComponentResult from,
                                                   ComponentSelectionReason reason, ModuleVersionResolveException failure) {
    List<Object> key = asList(requested, from);
    if (!unresolvedDependencies.containsKey(key)) {
        unresolvedDependencies.put(key, new DefaultUnresolvedDependencyResult(requested, reason, from, failure));
    }
    return unresolvedDependencies.get(key);
}
项目:Reer    文件:CachingDependencyResultFactory.java   
public ResolvedDependencyResult createResolvedDependency(ComponentSelector requested, ResolvedComponentResult from, DefaultResolvedComponentResult selected) {
    List<Object> key = asList(requested, from, selected);
    if (!resolvedDependencies.containsKey(key)) {
        resolvedDependencies.put(key, new DefaultResolvedDependencyResult(requested, selected, from));
    }
    return resolvedDependencies.get(key);
}
项目:Reer    文件:ResolutionResultsStoreFactory.java   
private synchronized CachedStoreFactory<ResolvedComponentResult> getNewModelCache() {
    if (newModelCache == null) {
        newModelCache = new CachedStoreFactory<ResolvedComponentResult>("Resolution result");
        cleanUpLater.add(newModelCache);
    }
    return newModelCache;
}
项目:Reer    文件:DefaultResolutionResult.java   
private void eachElement(ResolvedComponentResult node,
                         Action<? super ResolvedComponentResult> moduleAction, Action<? super DependencyResult> dependencyAction,
                         Set<ResolvedComponentResult> visited) {
    if (!visited.add(node)) {
        return;
    }
    moduleAction.execute(node);
    for (DependencyResult d : node.getDependencies()) {
        dependencyAction.execute(d);
        if (d instanceof ResolvedDependencyResult) {
            eachElement(((ResolvedDependencyResult) d).getSelected(), moduleAction, dependencyAction, visited);
        }
    }
}
项目:Reer    文件:AbstractDependencyResult.java   
public AbstractDependencyResult(ComponentSelector requested, ResolvedComponentResult from) {
    assert requested != null;
    assert from != null;

    this.from = from;
    this.requested = requested;
}
项目:Reer    文件:DefaultIdeDependencyResolver.java   
/**
 * Gets IDE project dependencies.
 *
 * @param configuration Configuration
 * @param project Project
 * @return IDE project dependencies
 */
public List<IdeProjectDependency> getIdeProjectDependencies(Configuration configuration, Project project) {
    ResolutionResult result = getIncomingResolutionResult(configuration);
    final Set<ResolvedComponentResult> projectComponents = CollectionUtils.filter(result.getAllComponents(), new Spec<ResolvedComponentResult>() {
        @Override
        public boolean isSatisfiedBy(ResolvedComponentResult element) {
            return element.getId() instanceof ProjectComponentIdentifier;
        }
    });
    List<IdeProjectDependency> ideProjectDependencies = new ArrayList<IdeProjectDependency>();

    ProjectComponentIdentifier thisProjectId = DefaultProjectComponentIdentifier.newProjectId(project);
    for (ResolvedComponentResult projectComponent : projectComponents) {
        ProjectComponentIdentifier projectId = (ProjectComponentIdentifier) projectComponent.getId();
        if (thisProjectId.equals(projectId)) {
            continue;
        }
        if (!projectId.getBuild().isCurrentBuild()) {
            // Don't have access to the ProjectInstance: we can't use it to determine the name.
            ideProjectDependencies.add(new IdeProjectDependency(projectId));
        } else {
            Project resolvedProject = project.project(projectId.getProjectPath());
            ideProjectDependencies.add(new IdeProjectDependency(projectId, resolvedProject.getName()));
        }
    }
    return ideProjectDependencies;
}
项目:Reer    文件:DefaultIdeDependencyResolver.java   
/**
 * Maps resolved dependencies by module version identifier.
 *
 * @param components Resolved dependencies
 * @return Mapped, resolved dependencies
 */
private Set<ModuleVersionIdentifier> mapResolvedDependencies(Set<ResolvedComponentResult> components) {
    Set<ModuleVersionIdentifier> mappedResolvedDependencies = new LinkedHashSet<ModuleVersionIdentifier>();
    for (ResolvedComponentResult component : components) {
        mappedResolvedDependencies.add(component.getModuleVersion());
    }
    return mappedResolvedDependencies;
}
项目:atlas    文件:DependencyResolver.java   
private boolean checkForExclusion(VariantDependencies configDependencies, ModuleVersionIdentifier moduleVersion,
                                  ResolvedComponentResult resolvedComponentResult) {
    if (configDependencies.getChecker().checkForExclusion(moduleVersion) || (apDependencies != null
                                                                             && apDependencies
                                                                                 .hasSameResolvedDependency(
                                                                                     moduleVersion)
                                                                             && !(resolvedComponentResult
        .getId() instanceof ProjectComponentIdentifier))) {
        return true;
    }
    return false;
}
项目:atlas    文件:AtlasDependencyManager.java   
@Override
protected boolean checkForExclusion(@NonNull VariantDependencies configDependencies,
                                    ModuleVersionIdentifier moduleVersion,
                                    ResolvedComponentResult resolvedComponentResult) {
    return super.checkForExclusion(configDependencies, moduleVersion, resolvedComponentResult) || (
        apDependencies != null && apDependencies.hasSameResolvedDependency(moduleVersion)
        && !(resolvedComponentResult.getId() instanceof ProjectComponentIdentifier));
}
项目:Pushjet-Android    文件:ErrorHandlingArtifactDependencyResolver.java   
public ResolvedComponentResult getRoot() {
    try {
        return resolutionResult.getRoot();
    } catch (Throwable e) {
        throw wrapException(e, configuration);
    }
}
项目:Pushjet-Android    文件:ErrorHandlingArtifactDependencyResolver.java   
public Set<ResolvedComponentResult> getAllComponents() {
    try {
        return resolutionResult.getAllComponents();
    } catch (Throwable e) {
        throw wrapException(e, configuration);
    }
}
项目:Pushjet-Android    文件:CachingDependencyResultFactory.java   
public UnresolvedDependencyResult createUnresolvedDependency(ComponentSelector requested, ResolvedComponentResult from,
                                                   ComponentSelectionReason reason, ModuleVersionResolveException failure) {
    List<Object> key = asList(requested, from);
    if (!unresolvedDependencies.containsKey(key)) {
        unresolvedDependencies.put(key, new DefaultUnresolvedDependencyResult(requested, reason, from, failure));
    }
    return unresolvedDependencies.get(key);
}
项目:Pushjet-Android    文件:CachingDependencyResultFactory.java   
public ResolvedDependencyResult createResolvedDependency(ComponentSelector requested, ResolvedComponentResult from, DefaultResolvedComponentResult selected) {
    List<Object> key = asList(requested, from, selected);
    if (!resolvedDependencies.containsKey(key)) {
        resolvedDependencies.put(key, new DefaultResolvedDependencyResult(requested, selected, from));
    }
    return resolvedDependencies.get(key);
}
项目:Pushjet-Android    文件:ResolutionResultsStoreFactory.java   
public StoreSet createStoreSet() {
    return new StoreSet() {
        int storeSetId = storeSetBaseId++;
        int binaryStoreId;
        public DefaultBinaryStore nextBinaryStore() {
            //one binary store per id+threadId
            String storeKey = Thread.currentThread().getId() + "-" + binaryStoreId++;
            return createBinaryStore(storeKey);
        }

        public Store<ResolvedComponentResult> oldModelStore() {
            if (oldModelCache == null) {
                oldModelCache = new CachedStoreFactory("Resolution result");
                cleanUpLater.add(oldModelCache);
            }
            return oldModelCache.createCachedStore(storeSetId);
        }

        public Store<TransientConfigurationResults> newModelStore() {
            if (newModelCache == null) {
                newModelCache = new CachedStoreFactory("Resolved configuration");
                cleanUpLater.add(newModelCache);
            }
            return newModelCache.createCachedStore(storeSetId);
        }
    };
}
项目:Pushjet-Android    文件:DefaultResolutionResult.java   
private void eachElement(ResolvedComponentResult node,
                         Action<? super ResolvedComponentResult> moduleAction, Action<? super DependencyResult> dependencyAction,
                         Set<ResolvedComponentResult> visited) {
    if (!visited.add(node)) {
        return;
    }
    moduleAction.execute(node);
    for (DependencyResult d : node.getDependencies()) {
        dependencyAction.execute(d);
        if (d instanceof ResolvedDependencyResult) {
            eachElement(((ResolvedDependencyResult) d).getSelected(), moduleAction, dependencyAction, visited);
        }
    }
}
项目:Pushjet-Android    文件:AbstractDependencyResult.java   
public AbstractDependencyResult(ComponentSelector requested, ResolvedComponentResult from) {
    assert requested != null;
    assert from != null;

    this.from = from;
    this.requested = requested;
}
项目:Pushjet-Android    文件:ErrorHandlingArtifactDependencyResolver.java   
public ResolvedComponentResult getRoot() {
    try {
        return resolutionResult.getRoot();
    } catch (Throwable e) {
        throw wrapException(e, configuration);
    }
}
项目:Pushjet-Android    文件:ErrorHandlingArtifactDependencyResolver.java   
public Set<ResolvedComponentResult> getAllComponents() {
    try {
        return resolutionResult.getAllComponents();
    } catch (Throwable e) {
        throw wrapException(e, configuration);
    }
}
项目:Pushjet-Android    文件:CachingDependencyResultFactory.java   
public UnresolvedDependencyResult createUnresolvedDependency(ComponentSelector requested, ResolvedComponentResult from,
                                                   ComponentSelectionReason reason, ModuleVersionResolveException failure) {
    List<Object> key = asList(requested, from);
    if (!unresolvedDependencies.containsKey(key)) {
        unresolvedDependencies.put(key, new DefaultUnresolvedDependencyResult(requested, reason, from, failure));
    }
    return unresolvedDependencies.get(key);
}
项目:Pushjet-Android    文件:CachingDependencyResultFactory.java   
public ResolvedDependencyResult createResolvedDependency(ComponentSelector requested, ResolvedComponentResult from, DefaultResolvedComponentResult selected) {
    List<Object> key = asList(requested, from, selected);
    if (!resolvedDependencies.containsKey(key)) {
        resolvedDependencies.put(key, new DefaultResolvedDependencyResult(requested, selected, from));
    }
    return resolvedDependencies.get(key);
}
项目:Pushjet-Android    文件:ResolutionResultsStoreFactory.java   
public StoreSet createStoreSet() {
    return new StoreSet() {
        int storeSetId = storeSetBaseId++;
        int binaryStoreId;
        public DefaultBinaryStore nextBinaryStore() {
            //one binary store per id+threadId
            String storeKey = Thread.currentThread().getId() + "-" + binaryStoreId++;
            return createBinaryStore(storeKey);
        }

        public Store<ResolvedComponentResult> oldModelStore() {
            if (oldModelCache == null) {
                oldModelCache = new CachedStoreFactory("Resolution result");
                cleanUpLater.add(oldModelCache);
            }
            return oldModelCache.createCachedStore(storeSetId);
        }

        public Store<TransientConfigurationResults> newModelStore() {
            if (newModelCache == null) {
                newModelCache = new CachedStoreFactory("Resolved configuration");
                cleanUpLater.add(newModelCache);
            }
            return newModelCache.createCachedStore(storeSetId);
        }
    };
}
项目:Pushjet-Android    文件:DefaultResolutionResult.java   
private void eachElement(ResolvedComponentResult node,
                         Action<? super ResolvedComponentResult> moduleAction, Action<? super DependencyResult> dependencyAction,
                         Set<ResolvedComponentResult> visited) {
    if (!visited.add(node)) {
        return;
    }
    moduleAction.execute(node);
    for (DependencyResult d : node.getDependencies()) {
        dependencyAction.execute(d);
        if (d instanceof ResolvedDependencyResult) {
            eachElement(((ResolvedDependencyResult) d).getSelected(), moduleAction, dependencyAction, visited);
        }
    }
}
项目:Pushjet-Android    文件:AbstractDependencyResult.java   
public AbstractDependencyResult(ComponentSelector requested, ResolvedComponentResult from) {
    assert requested != null;
    assert from != null;

    this.from = from;
    this.requested = requested;
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
public void allComponents(Action<? super ResolvedComponentResult> action) {
    resolutionResult.allComponents(action);
}
项目:Reer    文件:StreamingResolutionResultBuilder.java   
public StreamingResolutionResultBuilder(BinaryStore store, Store<ResolvedComponentResult> cache) {
    this.store = store;
    this.cache = cache;
}
项目:Reer    文件:StreamingResolutionResultBuilder.java   
public RootFactory(BinaryStore.BinaryData data, Map<ComponentSelector, ModuleVersionResolveException> failures,
                   Store<ResolvedComponentResult> cache) {
    this.data = data;
    this.failures = failures;
    this.cache = cache;
}
项目:Reer    文件:DefaultResolutionResultBuilder.java   
public ResolvedComponentResult create() {
    return rootModule;
}
项目:Reer    文件:DefaultResolutionResult.java   
public DefaultResolutionResult(Factory<ResolvedComponentResult> rootSource) {
    assert rootSource != null;
    this.rootSource = rootSource;
}
项目:Reer    文件:DefaultResolutionResult.java   
public ResolvedComponentResult getRoot() {
    return rootSource.create();
}
项目:Reer    文件:DefaultResolutionResult.java   
public void allDependencies(Action<? super DependencyResult> action) {
    eachElement(getRoot(), Actions.doNothing(), action, new HashSet<ResolvedComponentResult>());
}
项目:Reer    文件:DefaultResolutionResult.java   
public Set<ResolvedComponentResult> getAllComponents() {
    final Set<ResolvedComponentResult> out = new LinkedHashSet<ResolvedComponentResult>();
    eachElement(getRoot(), Actions.doNothing(), Actions.doNothing(), out);
    return out;
}