use of org.gradle.internal.hash.ChecksumService in project gradle by gradle.
the class DependencyManagementBuildScopeServices method createModuleRepositoryCacheProvider.
ModuleRepositoryCacheProvider createModuleRepositoryCacheProvider(BuildCommencedTimeProvider timeProvider, ImmutableModuleIdentifierFactory moduleIdentifierFactory, ArtifactCachesProvider artifactCaches, AttributeContainerSerializer attributeContainerSerializer, MavenMutableModuleMetadataFactory mavenMetadataFactory, IvyMutableModuleMetadataFactory ivyMetadataFactory, SimpleMapInterner stringInterner, FileStoreAndIndexProvider fileStoreAndIndexProvider, ModuleSourcesSerializer moduleSourcesSerializer, ChecksumService checksumService) {
ArtifactIdentifierFileStore artifactIdentifierFileStore = fileStoreAndIndexProvider.getArtifactIdentifierFileStore();
ModuleRepositoryCaches writableCaches = artifactCaches.withWritableCache((md, manager) -> prepareModuleRepositoryCaches(md, manager, timeProvider, moduleIdentifierFactory, attributeContainerSerializer, mavenMetadataFactory, ivyMetadataFactory, stringInterner, artifactIdentifierFileStore, moduleSourcesSerializer, checksumService));
AtomicReference<Path> roCachePath = new AtomicReference<>();
Optional<ModuleRepositoryCaches> readOnlyCaches = artifactCaches.withReadOnlyCache((ro, manager) -> {
roCachePath.set(ro.getCacheDir().toPath());
return prepareReadOnlyModuleRepositoryCaches(ro, manager, timeProvider, moduleIdentifierFactory, attributeContainerSerializer, mavenMetadataFactory, ivyMetadataFactory, stringInterner, artifactIdentifierFileStore, moduleSourcesSerializer, checksumService);
});
AbstractModuleVersionsCache moduleVersionsCache = readOnlyCaches.map(mrc -> (AbstractModuleVersionsCache) new TwoStageModuleVersionsCache(timeProvider, mrc.moduleVersionsCache, writableCaches.moduleVersionsCache)).orElse(writableCaches.moduleVersionsCache);
AbstractModuleMetadataCache persistentModuleMetadataCache = readOnlyCaches.map(mrc -> (AbstractModuleMetadataCache) new TwoStageModuleMetadataCache(timeProvider, mrc.moduleMetadataCache, writableCaches.moduleMetadataCache)).orElse(writableCaches.moduleMetadataCache);
AbstractArtifactsCache moduleArtifactsCache = readOnlyCaches.map(mrc -> (AbstractArtifactsCache) new TwoStageArtifactsCache(timeProvider, mrc.moduleArtifactsCache, writableCaches.moduleArtifactsCache)).orElse(writableCaches.moduleArtifactsCache);
ModuleArtifactCache moduleArtifactCache = readOnlyCaches.map(mrc -> (ModuleArtifactCache) new TwoStageModuleArtifactCache(roCachePath.get(), mrc.moduleArtifactCache, writableCaches.moduleArtifactCache)).orElse(writableCaches.moduleArtifactCache);
ModuleRepositoryCaches persistentCaches = new ModuleRepositoryCaches(new InMemoryModuleVersionsCache(timeProvider, moduleVersionsCache), new InMemoryModuleMetadataCache(timeProvider, persistentModuleMetadataCache), new InMemoryModuleArtifactsCache(timeProvider, moduleArtifactsCache), new InMemoryModuleArtifactCache(timeProvider, moduleArtifactCache));
ModuleRepositoryCaches inMemoryOnlyCaches = new ModuleRepositoryCaches(new InMemoryModuleVersionsCache(timeProvider), new InMemoryModuleMetadataCache(timeProvider), new InMemoryModuleArtifactsCache(timeProvider), new InMemoryModuleArtifactCache(timeProvider));
return new ModuleRepositoryCacheProvider(persistentCaches, inMemoryOnlyCaches);
}
use of org.gradle.internal.hash.ChecksumService in project gradle by gradle.
the class ChecksumAndSignatureVerificationOverride method verifyConcurrently.
private void verifyConcurrently() {
hasFatalFailure.set(false);
synchronized (verificationEvents) {
if (verificationEvents.isEmpty()) {
return;
}
}
if (closed.get()) {
LOGGER.debug("Cannot perform verification of all dependencies because the verification service has been shutdown. Under normal circumstances this shouldn't happen unless a user buildFinished was added in an unexpected way.");
return;
}
buildOperationExecutor.runAll(queue -> {
VerificationEvent event;
synchronized (verificationEvents) {
while ((event = verificationEvents.poll()) != null) {
VerificationEvent ve = event;
queue.add(new RunnableBuildOperation() {
@Override
public void run(BuildOperationContext context) {
verifier.verify(checksumService, signatureVerificationService, ve.kind, ve.artifact, ve.mainFile, ve.signatureFile.create(), f -> {
synchronized (failures) {
failures.put(ve.artifact, new RepositoryAwareVerificationFailure(f, ve.repositoryName));
}
if (f.isFatal()) {
hasFatalFailure.set(true);
}
});
}
@Override
public BuildOperationDescriptor.Builder description() {
return BuildOperationDescriptor.displayName("Dependency verification").progressDisplayName("Verifying " + ve.artifact);
}
});
}
}
});
}
use of org.gradle.internal.hash.ChecksumService in project gradle by gradle.
the class LocallyAvailableResourceFinderFactory method create.
@Override
public LocallyAvailableResourceFinder<ModuleComponentArtifactMetadata> create() {
List<LocallyAvailableResourceFinder<ModuleComponentArtifactMetadata>> finders = new LinkedList<>();
// Order is important here, because they will be searched in that order
// The current filestore
finders.add(new LocallyAvailableResourceFinderSearchableFileStoreAdapter<>(key -> fileStore.search(key.getId()), checksumService));
// 1.8
addForPattern(finders, "artifacts-26/filestore/[organisation]/[module](/[branch])/[revision]/[type]/*/[artifact]-[revision](-[classifier])(.[ext])");
// 1.5
addForPattern(finders, "artifacts-24/filestore/[organisation]/[module](/[branch])/[revision]/[type]/*/[artifact]-[revision](-[classifier])(.[ext])");
// 1.4
addForPattern(finders, "artifacts-23/filestore/[organisation]/[module](/[branch])/[revision]/[type]/*/[artifact]-[revision](-[classifier])(.[ext])");
// 1.3
addForPattern(finders, "artifacts-15/filestore/[organisation]/[module](/[branch])/[revision]/[type]/*/[artifact]-[revision](-[classifier])(.[ext])");
// 1.1, 1.2
addForPattern(finders, "artifacts-14/filestore/[organisation]/[module](/[branch])/[revision]/[type]/*/[artifact]-[revision](-[classifier])(.[ext])");
// rc-1, 1.0
addForPattern(finders, "artifacts-13/filestore/[organisation]/[module](/[branch])/[revision]/[type]/*/[artifact]-[revision](-[classifier])(.[ext])");
// Milestone 8 and 9
addForPattern(finders, "artifacts-8/filestore/[organisation]/[module](/[branch])/[revision]/[type]/*/[artifact]-[revision](-[classifier])(.[ext])");
// Milestone 7
addForPattern(finders, "artifacts-7/artifacts/*/[organisation]/[module](/[branch])/[revision]/[type]/[artifact]-[revision](-[classifier])(.[ext])");
// Milestone 6
addForPattern(finders, "artifacts-4/[organisation]/[module](/[branch])/*/[type]s/[artifact]-[revision](-[classifier])(.[ext])");
addForPattern(finders, "artifacts-4/[organisation]/[module](/[branch])/*/pom.originals/[artifact]-[revision](-[classifier])(.[ext])");
// Milestone 3
addForPattern(finders, "../cache/[organisation]/[module](/[branch])/[type]s/[artifact]-[revision](-[classifier])(.[ext])");
// Maven local
try {
File localMavenRepository = localMavenRepositoryLocator.getLocalMavenRepository();
if (localMavenRepository.exists()) {
addForPattern(finders, localMavenRepository, new M2ResourcePattern("[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])"));
}
} catch (CannotLocateLocalMavenRepositoryException ex) {
finders.add(new NoMavenLocalRepositoryResourceFinder(ex));
}
return new CompositeLocallyAvailableResourceFinder<>(finders);
}
Aggregations