use of org.gradle.internal.component.local.model.OpaqueComponentIdentifier in project gradle by gradle.
the class DependencyClassPathNotationConverter method maybeCreateUnderLock.
private SelfResolvingDependency maybeCreateUnderLock(final DependencyFactory.ClassPathNotation notation) {
SelfResolvingDependency dependency = internCache.get(notation);
if (dependency == null) {
final Collection<File> classpath = classPathRegistry.getClassPath(notation.name()).getAsFiles();
boolean runningFromInstallation = currentGradleInstallation.getInstallation() != null;
FileCollectionInternal fileCollectionInternal;
if (runningFromInstallation && notation.equals(GRADLE_API)) {
fileCollectionInternal = new GeneratedFileCollection(notation.displayName) {
@Override
FileCollection generateFileCollection() {
try {
internCacheWriteLock.lock();
return gradleApiFileCollection(classpath);
} finally {
internCacheWriteLock.unlock();
}
}
};
} else if (runningFromInstallation && notation.equals(GRADLE_TEST_KIT)) {
fileCollectionInternal = new GeneratedFileCollection(notation.displayName) {
@Override
FileCollection generateFileCollection() {
try {
internCacheWriteLock.lock();
return gradleTestKitFileCollection(classpath);
} finally {
internCacheWriteLock.unlock();
}
}
};
} else {
fileCollectionInternal = fileResolver.resolveFiles(classpath);
}
dependency = instantiator.newInstance(DefaultSelfResolvingDependency.class, new OpaqueComponentIdentifier(notation.displayName), fileCollectionInternal);
internCache.put(notation, dependency);
}
return dependency;
}
use of org.gradle.internal.component.local.model.OpaqueComponentIdentifier in project gradle by gradle.
the class DependencyClassPathNotationConverter method create.
private SelfResolvingDependency create(final DependencyFactory.ClassPathNotation notation) {
boolean runningFromInstallation = currentGradleInstallation.getInstallation() != null;
FileCollectionInternal fileCollectionInternal;
if (runningFromInstallation && notation.equals(GRADLE_API)) {
fileCollectionInternal = fileCollectionFactory.create(new GeneratedFileCollection(notation.displayName) {
@Override
Set<File> generateFileCollection() {
return gradleApiFileCollection(getClassPath(notation));
}
});
} else if (runningFromInstallation && notation.equals(GRADLE_TEST_KIT)) {
fileCollectionInternal = fileCollectionFactory.create(new GeneratedFileCollection(notation.displayName) {
@Override
Set<File> generateFileCollection() {
return gradleTestKitFileCollection(getClassPath(notation));
}
});
} else {
fileCollectionInternal = fileCollectionFactory.resolving(getClassPath(notation));
}
SelfResolvingDependency dependency = instantiator.newInstance(DefaultSelfResolvingDependency.class, new OpaqueComponentIdentifier(notation), fileCollectionInternal);
SelfResolvingDependency alreadyPresent = internCache.putIfAbsent(notation, dependency);
return alreadyPresent != null ? alreadyPresent : dependency;
}
Aggregations