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

项目:Reer    文件:DependencyClassPathNotationConverter.java   
private SelfResolvingDependency maybeCreateUnderLock(DependencyFactory.ClassPathNotation notation) {
    SelfResolvingDependency dependency = internCache.get(notation);
    if (dependency == null) {
        Collection<File> classpath = classPathRegistry.getClassPath(notation.name()).getAsFiles();
        boolean runningFromInstallation = currentGradleInstallation.getInstallation() != null;
        FileCollectionInternal files;
        if (runningFromInstallation && notation.equals(GRADLE_API)) {
            files = gradleApiFileCollection(classpath);
        } else if (runningFromInstallation && notation.equals(GRADLE_TEST_KIT)) {
            files = gradleTestKitFileCollection(classpath);
        } else {
            files = fileResolver.resolveFiles(classpath);
        }
        dependency = instantiator.newInstance(DefaultSelfResolvingDependency.class, new OpaqueComponentIdentifier(notation.displayName), files);
        internCache.put(notation, dependency);
    }
    return dependency;
}
项目:Reer    文件:DefaultIdeDependencyResolver.java   
/**
 * Gets IDE local file dependencies.
 *
 * @param configuration Configuration
 * @return IDE local file dependencies
 */
public List<IdeLocalFileDependency> getIdeLocalFileDependencies(Configuration configuration) {
    List<SelfResolvingDependency> externalDependencies = new ArrayList<SelfResolvingDependency>();
    findAllExternalDependencies(externalDependencies, new ArrayList<Dependency>(), configuration);
    List<IdeLocalFileDependency> ideLocalFileDependencies = new ArrayList<IdeLocalFileDependency>();

    for (SelfResolvingDependency externalDependency : externalDependencies) {
        Set<File> resolvedFiles = externalDependency.resolve();

        for (File resolvedFile : resolvedFiles) {
            IdeLocalFileDependency ideLocalFileDependency = new IdeLocalFileDependency(resolvedFile);
            ideLocalFileDependencies.add(ideLocalFileDependency);
        }
    }

    return ideLocalFileDependencies;
}
项目:Reer    文件:DependencyClassPathNotationConverter.java   
public void convert(DependencyFactory.ClassPathNotation notation, NotationConvertResult<? super SelfResolvingDependency> result) throws TypeConversionException {
    SelfResolvingDependency dependency = internCache.get(notation);
    if (dependency == null) {
        internCacheWriteLock.lock();
        try {
            dependency = maybeCreateUnderLock(notation);
        } finally {
            internCacheWriteLock.unlock();
        }
    }

    result.converted(dependency);
}
项目:Reer    文件:DefaultIdeDependencyResolver.java   
/**
 * Finds all external dependencies.
 *
 * @param configuration Configuration
 * @return External dependencies
 */
private List<SelfResolvingDependency> findAllExternalDependencies(List<SelfResolvingDependency> externalDependencies, List<Dependency> visited, Configuration configuration) {
    for (Dependency dependency : configuration.getAllDependencies()) {
        if(!visited.contains(dependency)){
            visited.add(dependency);
            if(dependency instanceof ProjectDependency) {
                findAllExternalDependencies(externalDependencies, visited, getTargetConfiguration((ProjectDependency) dependency));
            } else if (dependency instanceof SelfResolvingDependency) {
                externalDependencies.add((SelfResolvingDependency) dependency);
            }
        }
    }
    return externalDependencies;
}
项目:gradle-project-config    文件:ProjectConfigPlugin.java   
/**
 * Format a dependency for printing
 *
 * @param dependency Dependency to format
 * @return Dependency information for printing
 */
private String formatDependency(Dependency dependency) {
    @NonNull String info;

    if (dependency instanceof SelfResolvingDependency) {
        SelfResolvingDependency selfResolvingDependency = (SelfResolvingDependency) dependency;
        info = Validate.notNull(Joiner.on(", ").join(selfResolvingDependency.resolve()));
    }
    else {
        info = dependency.getGroup() + ":" + dependency.getName() + ":" + dependency.getVersion();
    }

    return info;
}
项目:Reer    文件:DependencyFilesNotationConverter.java   
public void convert(FileCollection notation, NotationConvertResult<? super SelfResolvingDependency> result) throws TypeConversionException {
    result.converted(instantiator.newInstance(DefaultSelfResolvingDependency.class, notation));
}
项目:Pushjet-Android    文件:DependencyFilesNotationParser.java   
public void convert(FileCollection notation, NotationConvertResult<? super SelfResolvingDependency> result) throws TypeConversionException {
    result.converted(instantiator.newInstance(DefaultSelfResolvingDependency.class, notation));
}
项目:Pushjet-Android    文件:DependencyClassPathNotationParser.java   
public void convert(DependencyFactory.ClassPathNotation notation, NotationConvertResult<? super SelfResolvingDependency> result) throws TypeConversionException {
    Collection<File> classpath = classPathRegistry.getClassPath(notation.name()).getAsFiles();
    FileCollection files = fileResolver.resolveFiles(classpath);
    result.converted(instantiator.newInstance(DefaultSelfResolvingDependency.class, files));
}
项目:Pushjet-Android    文件:DefaultDependencySet.java   
public void resolve(TaskDependencyResolveContext context) {
    for (SelfResolvingDependency dependency : DefaultDependencySet.this.withType(SelfResolvingDependency.class)) {
        context.add(dependency);
    }
}
项目:Pushjet-Android    文件:DefaultSelfResolvingDependency.java   
public SelfResolvingDependency copy() {
    return new DefaultSelfResolvingDependency(source);
}
项目:Pushjet-Android    文件:DependencyFilesNotationParser.java   
public SelfResolvingDependency parseType(FileCollection notation) {
    return instantiator.newInstance(DefaultSelfResolvingDependency.class, notation);
}
项目:Pushjet-Android    文件:DependencyClassPathNotationParser.java   
public SelfResolvingDependency parseType(DependencyFactory.ClassPathNotation notation) {
    Collection<File> classpath = classPathRegistry.getClassPath(notation.name()).getAsFiles();
    FileCollection files = fileResolver.resolveFiles(classpath);
    return instantiator.newInstance(DefaultSelfResolvingDependency.class, files);
}
项目:Pushjet-Android    文件:DefaultDependencySet.java   
public void resolve(TaskDependencyResolveContext context) {
    for (SelfResolvingDependency dependency : DefaultDependencySet.this.withType(SelfResolvingDependency.class)) {
        context.add(dependency);
    }
}
项目:Pushjet-Android    文件:DefaultSelfResolvingDependency.java   
public SelfResolvingDependency copy() {
    return new DefaultSelfResolvingDependency(source);
}