use of org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.InMemoryModuleArtifactsCache 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.api.internal.artifacts.ivyservice.modulecache.artifacts.InMemoryModuleArtifactsCache in project gradle by gradle.
the class DependencyManagementBuildScopeServices method createModuleRepositoryCacheProvider.
ModuleRepositoryCacheProvider createModuleRepositoryCacheProvider(BuildCommencedTimeProvider timeProvider, CacheLockingManager cacheLockingManager, ImmutableModuleIdentifierFactory moduleIdentifierFactory, ArtifactCacheMetadata artifactCacheMetadata, AttributeContainerSerializer attributeContainerSerializer, MavenMutableModuleMetadataFactory mavenMetadataFactory, IvyMutableModuleMetadataFactory ivyMetadataFactory) {
ModuleRepositoryCaches caches = new ModuleRepositoryCaches(new DefaultModuleVersionsCache(timeProvider, cacheLockingManager, moduleIdentifierFactory), new DefaultModuleMetadataCache(timeProvider, cacheLockingManager, artifactCacheMetadata, moduleIdentifierFactory, attributeContainerSerializer, mavenMetadataFactory, ivyMetadataFactory), new DefaultModuleArtifactsCache(timeProvider, cacheLockingManager), new DefaultModuleArtifactCache("module-artifact", timeProvider, cacheLockingManager));
ModuleRepositoryCaches inMemoryCaches = new ModuleRepositoryCaches(new InMemoryModuleVersionsCache(timeProvider), new InMemoryModuleMetadataCache(timeProvider), new InMemoryModuleArtifactsCache(timeProvider), new InMemoryModuleArtifactCache(timeProvider));
return new ModuleRepositoryCacheProvider(caches, inMemoryCaches);
}
Aggregations