Search in sources :

Example 1 with ChecksumService

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);
}
Also used : ArtifactIdentifierFileStore(org.gradle.api.internal.filestore.ArtifactIdentifierFileStore) DefaultArtifactIdentifierFileStore(org.gradle.api.internal.filestore.DefaultArtifactIdentifierFileStore) TwoStageArtifactIdentifierFileStore(org.gradle.api.internal.filestore.TwoStageArtifactIdentifierFileStore) Path(java.nio.file.Path) NamedObjectInstantiator(org.gradle.api.internal.model.NamedObjectInstantiator) ProjectDependencyResolver(org.gradle.api.internal.artifacts.ivyservice.projectmodule.ProjectDependencyResolver) ValidateStep(org.gradle.internal.execution.steps.ValidateStep) BuildState(org.gradle.internal.build.BuildState) StartParameterResolutionOverride(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.StartParameterResolutionOverride) ComponentSelectionDescriptorFactory(org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.ComponentSelectionDescriptorFactory) AssignWorkspaceStep(org.gradle.internal.execution.steps.AssignWorkspaceStep) ProgressLoggerFactory(org.gradle.internal.logging.progress.ProgressLoggerFactory) InMemoryModuleArtifactCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.InMemoryModuleArtifactCache) ExecutionResult(org.gradle.internal.execution.ExecutionResult) Duration(java.time.Duration) Map(java.util.Map) ModuleMetadataSerializer(org.gradle.api.internal.artifacts.ivyservice.modulecache.ModuleMetadataSerializer) FileStoreAndIndexProvider(org.gradle.api.internal.artifacts.ivyservice.modulecache.FileStoreAndIndexProvider) AbstractArtifactsCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.AbstractArtifactsCache) ValueSnapshotter(org.gradle.internal.snapshot.ValueSnapshotter) Path(java.nio.file.Path) Step(org.gradle.internal.execution.steps.Step) RuntimeShadedJarFactory(org.gradle.api.internal.runtimeshaded.RuntimeShadedJarFactory) TwoStageModuleVersionsCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.dynamicversions.TwoStageModuleVersionsCache) CalculatedValueContainerFactory(org.gradle.internal.model.CalculatedValueContainerFactory) Capability(org.gradle.api.capabilities.Capability) DesugaredAttributeContainerSerializer(org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.DesugaredAttributeContainerSerializer) ModuleRepositoryCacheProvider(org.gradle.api.internal.artifacts.ivyservice.modulecache.ModuleRepositoryCacheProvider) BroadcastChangingOutputsStep(org.gradle.internal.execution.steps.BroadcastChangingOutputsStep) PersistentModuleMetadataCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.PersistentModuleMetadataCache) ResolverProviderFactory(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ResolverProviderFactory) NotationParser(org.gradle.internal.typeconversion.NotationParser) ExternalResourceAccessor(org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceAccessor) OutputSnapshotter(org.gradle.internal.execution.OutputSnapshotter) ExecuteStep(org.gradle.internal.execution.steps.ExecuteStep) ChangingValueDependencyResolutionListener(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ChangingValueDependencyResolutionListener) ExecutionEngine(org.gradle.internal.execution.ExecutionEngine) FeaturePreviews(org.gradle.api.internal.FeaturePreviews) RelativeFilePathResolver(org.gradle.internal.file.RelativeFilePathResolver) LocallyAvailableResourceFinderFactory(org.gradle.internal.resource.local.ivy.LocallyAvailableResourceFinderFactory) ClasspathWalker(org.gradle.internal.classpath.ClasspathWalker) DefaultLocalMavenRepositoryLocator(org.gradle.api.internal.artifacts.mvnsettings.DefaultLocalMavenRepositoryLocator) UnitOfWork(org.gradle.internal.execution.UnitOfWork) ResolveChangesStep(org.gradle.internal.execution.steps.ResolveChangesStep) ClassPathRegistry(org.gradle.api.internal.ClassPathRegistry) InMemoryModuleArtifactsCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.InMemoryModuleArtifactsCache) UpToDateResult(org.gradle.internal.execution.steps.UpToDateResult) TwoStageModuleMetadataCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.TwoStageModuleMetadataCache) ProjectDependencyFactory(org.gradle.api.internal.notations.ProjectDependencyFactory) AttributeContainerSerializer(org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.AttributeContainerSerializer) GeneratedGradleJarCache(org.gradle.cache.internal.GeneratedGradleJarCache) LocalComponentMetadataBuilder(org.gradle.api.internal.artifacts.ivyservice.moduleconverter.LocalComponentMetadataBuilder) Try(org.gradle.internal.Try) ProjectArtifactResolver(org.gradle.api.internal.artifacts.ivyservice.projectmodule.ProjectArtifactResolver) GlobalScopedCache(org.gradle.cache.scopes.GlobalScopedCache) CollectionCallbackActionDecorator(org.gradle.api.internal.CollectionCallbackActionDecorator) DependencyConstraintNotationParser(org.gradle.api.internal.notations.DependencyConstraintNotationParser) CachedExternalResourceIndex(org.gradle.internal.resource.cached.CachedExternalResourceIndex) MavenSettingsProvider(org.gradle.api.internal.artifacts.mvnsettings.MavenSettingsProvider) ReadOnlyModuleArtifactCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.ReadOnlyModuleArtifactCache) DependencyDescriptorFactory(org.gradle.api.internal.artifacts.ivyservice.moduleconverter.dependencies.DependencyDescriptorFactory) BuildCommencedTimeProvider(org.gradle.util.internal.BuildCommencedTimeProvider) LocalMavenRepositoryLocator(org.gradle.api.internal.artifacts.mvnsettings.LocalMavenRepositoryLocator) CachingResult(org.gradle.internal.execution.steps.CachingResult) ChecksumService(org.gradle.internal.hash.ChecksumService) RepositoryDisabler(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryDisabler) ModuleRepositoryCaches(org.gradle.api.internal.artifacts.ivyservice.modulecache.ModuleRepositoryCaches) IvyMutableModuleMetadataFactory(org.gradle.api.internal.artifacts.repositories.metadata.IvyMutableModuleMetadataFactory) InputFingerprinter(org.gradle.internal.execution.fingerprint.InputFingerprinter) DefaultMavenFileLocations(org.gradle.api.internal.artifacts.mvnsettings.DefaultMavenFileLocations) DependencyResolutionManagementInternal(org.gradle.internal.management.DependencyResolutionManagementInternal) ClasspathBuilder(org.gradle.internal.classpath.ClasspathBuilder) IdentityCacheStep(org.gradle.internal.execution.steps.IdentityCacheStep) ImmutableAttributesFactory(org.gradle.api.internal.attributes.ImmutableAttributesFactory) ServiceRegistration(org.gradle.internal.service.ServiceRegistration) ProjectArtifactSetResolver(org.gradle.api.internal.artifacts.ivyservice.projectmodule.ProjectArtifactSetResolver) SignatureVerificationServiceFactory(org.gradle.api.internal.artifacts.verification.signatures.SignatureVerificationServiceFactory) LocalComponentRegistry(org.gradle.api.internal.artifacts.ivyservice.projectmodule.LocalComponentRegistry) RemovePreviousOutputsStep(org.gradle.internal.execution.steps.RemovePreviousOutputsStep) UniqueId(org.gradle.internal.id.UniqueId) DefaultDependenciesAccessors(org.gradle.api.internal.catalog.DefaultDependenciesAccessors) ModuleDescriptorHashCodec(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ModuleDescriptorHashCodec) DefaultArtifactDependencyResolver(org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultArtifactDependencyResolver) CachingState(org.gradle.internal.execution.caching.CachingState) BuildStateRegistry(org.gradle.internal.build.BuildStateRegistry) DependencyFactory(org.gradle.api.internal.artifacts.dsl.dependencies.DependencyFactory) BeforeExecutionState(org.gradle.internal.execution.history.BeforeExecutionState) DefaultProjectLocalComponentProvider(org.gradle.api.internal.artifacts.ivyservice.projectmodule.DefaultProjectLocalComponentProvider) CreateOutputsStep(org.gradle.internal.execution.steps.CreateOutputsStep) ArtifactIdentifierFileStore(org.gradle.api.internal.filestore.ArtifactIdentifierFileStore) CapabilityNotationParserFactory(org.gradle.api.internal.artifacts.dsl.CapabilityNotationParserFactory) FileHasher(org.gradle.internal.hash.FileHasher) HashSet(java.util.HashSet) ImmutableList(com.google.common.collect.ImmutableList) ModuleSourcesSerializer(org.gradle.api.internal.artifacts.ivyservice.modulecache.ModuleSourcesSerializer) GradleInternal(org.gradle.api.internal.GradleInternal) DefaultMavenSettingsProvider(org.gradle.api.internal.artifacts.mvnsettings.DefaultMavenSettingsProvider) ListenerManager(org.gradle.internal.event.ListenerManager) DesugaringAttributeContainerSerializer(org.gradle.internal.resolve.caching.DesugaringAttributeContainerSerializer) TimeoutHandler(org.gradle.internal.execution.timeout.TimeoutHandler) OutputChangeListener(org.gradle.internal.execution.OutputChangeListener) TwoStageByUrlCachedExternalResourceIndex(org.gradle.internal.resource.cached.TwoStageByUrlCachedExternalResourceIndex) ProviderFactory(org.gradle.api.provider.ProviderFactory) DefaultComponentIdentifierFactory(org.gradle.api.internal.artifacts.component.DefaultComponentIdentifierFactory) ApiTextResourceAdapter(org.gradle.api.internal.resources.ApiTextResourceAdapter) DefaultArtifactIdentifierFileStore(org.gradle.api.internal.filestore.DefaultArtifactIdentifierFileStore) DependencyMetaDataProvider(org.gradle.api.internal.artifacts.configurations.DependencyMetaDataProvider) ReadOnlyModuleMetadataCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.ReadOnlyModuleMetadataCache) ConnectionFailureRepositoryDisabler(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ConnectionFailureRepositoryDisabler) LocalComponentProvider(org.gradle.api.internal.artifacts.ivyservice.projectmodule.LocalComponentProvider) ProjectPublicationRegistry(org.gradle.api.internal.artifacts.ivyservice.projectmodule.ProjectPublicationRegistry) DependencyVerificationOverride(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.verification.DependencyVerificationOverride) CurrentFileCollectionFingerprint(org.gradle.internal.fingerprint.CurrentFileCollectionFingerprint) UserCodeApplicationContext(org.gradle.configuration.internal.UserCodeApplicationContext) AbstractModuleVersionsCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.dynamicversions.AbstractModuleVersionsCache) ArtifactCachesProvider(org.gradle.api.internal.artifacts.ivyservice.ArtifactCachesProvider) AfterExecutionState(org.gradle.internal.execution.history.AfterExecutionState) PreviousExecutionState(org.gradle.internal.execution.history.PreviousExecutionState) WorkValidationContext(org.gradle.internal.execution.WorkValidationContext) ExternalResourceFileStore(org.gradle.internal.resource.cached.ExternalResourceFileStore) CachingTextUriResourceLoader(org.gradle.internal.resource.transfer.CachingTextUriResourceLoader) DocumentationRegistry(org.gradle.api.internal.DocumentationRegistry) ModuleDescriptorHashModuleSource(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ModuleDescriptorHashModuleSource) CurrentGradleInstallation(org.gradle.internal.installation.CurrentGradleInstallation) ProducerGuard(org.gradle.cache.internal.ProducerGuard) VirtualFileSystem(org.gradle.internal.vfs.VirtualFileSystem) DefaultModuleArtifactsCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.DefaultModuleArtifactsCache) CurrentBuildOperationRef(org.gradle.internal.operations.CurrentBuildOperationRef) BuildOperationExecutor(org.gradle.internal.operations.BuildOperationExecutor) VersionComparator(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.VersionComparator) DefaultSignatureVerificationServiceFactory(org.gradle.api.internal.artifacts.verification.signatures.DefaultSignatureVerificationServiceFactory) DefaultModuleArtifactCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.DefaultModuleArtifactCache) InternalBuildFinishedListener(org.gradle.initialization.internal.InternalBuildFinishedListener) ComponentIdentifierFactory(org.gradle.api.internal.artifacts.component.ComponentIdentifierFactory) ServiceRegistry(org.gradle.internal.service.ServiceRegistry) TwoStageExternalResourceFileStore(org.gradle.internal.resource.cached.TwoStageExternalResourceFileStore) ModuleArtifactCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.ModuleArtifactCache) TextUriResourceLoader(org.gradle.internal.resource.TextUriResourceLoader) CleaningInMemoryCacheDecoratorFactory(org.gradle.cache.internal.CleaningInMemoryCacheDecoratorFactory) LoadPreviousExecutionStateStep(org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep) ResolveIvyFactory(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ResolveIvyFactory) TwoStageArtifactsCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.TwoStageArtifactsCache) BuildScopedCache(org.gradle.cache.scopes.BuildScopedCache) ImmutableSortedMap(com.google.common.collect.ImmutableSortedMap) FileResourceRepository(org.gradle.internal.resource.local.FileResourceRepository) DefaultVersionComparator(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.DefaultVersionComparator) OverlappingOutputDetector(org.gradle.internal.execution.history.OverlappingOutputDetector) RemoveUntrackedExecutionStateStep(org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep) File(java.io.File) DefaultVersionSelectorScheme(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.DefaultVersionSelectorScheme) DefaultModuleVersionsCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.dynamicversions.DefaultModuleVersionsCache) Instantiator(org.gradle.internal.reflect.Instantiator) ObjectFactory(org.gradle.api.model.ObjectFactory) DefaultMetadataFileSourceCodec(org.gradle.api.internal.artifacts.repositories.metadata.DefaultMetadataFileSourceCodec) DefaultExternalResourceAccessor(org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceAccessor) ResolveInputChangesStep(org.gradle.internal.execution.steps.ResolveInputChangesStep) InMemoryModuleVersionsCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.dynamicversions.InMemoryModuleVersionsCache) ExternalResourceName(org.gradle.internal.resource.ExternalResourceName) MavenMutableModuleMetadataFactory(org.gradle.api.internal.artifacts.repositories.metadata.MavenMutableModuleMetadataFactory) DefaultExecutionEngine(org.gradle.internal.execution.impl.DefaultExecutionEngine) LocallyAvailableResourceFinder(org.gradle.internal.resource.local.LocallyAvailableResourceFinder) TimeoutStep(org.gradle.internal.execution.steps.TimeoutStep) IdentifyStep(org.gradle.internal.execution.steps.IdentifyStep) ClientModuleNotationParserFactory(org.gradle.api.internal.notations.ClientModuleNotationParserFactory) PersistentModuleSource(org.gradle.internal.component.model.PersistentModuleSource) DefaultProjectPublicationRegistry(org.gradle.api.internal.artifacts.ivyservice.projectmodule.DefaultProjectPublicationRegistry) ClassLoaderHierarchyHasher(org.gradle.internal.hash.ClassLoaderHierarchyHasher) StartParameter(org.gradle.StartParameter) PreferJavaRuntimeVariant(org.gradle.internal.component.external.model.PreferJavaRuntimeVariant) ResourceConnectorFactory(org.gradle.internal.resource.connector.ResourceConnectorFactory) SuppliedComponentMetadataSerializer(org.gradle.api.internal.artifacts.ivyservice.modulecache.SuppliedComponentMetadataSerializer) FileResourceListener(org.gradle.internal.resource.local.FileResourceListener) ImmutableMap(com.google.common.collect.ImmutableMap) TwoStageModuleArtifactCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.TwoStageModuleArtifactCache) ValueSnapshot(org.gradle.internal.snapshot.ValueSnapshot) ReadOnlyModuleArtifactsCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.ReadOnlyModuleArtifactsCache) CaptureStateAfterExecutionStep(org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep) Sets(com.google.common.collect.Sets) List(java.util.List) ArtifactCacheMetadata(org.gradle.api.internal.artifacts.ivyservice.ArtifactCacheMetadata) StoreExecutionStateStep(org.gradle.internal.execution.steps.StoreExecutionStateStep) InMemoryModuleMetadataCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.InMemoryModuleMetadataCache) VersionParser(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.VersionParser) Optional(java.util.Optional) ComponentMetadataSupplierRuleExecutor(org.gradle.internal.resolve.caching.ComponentMetadataSupplierRuleExecutor) OriginMetadata(org.gradle.caching.internal.origin.OriginMetadata) SkipUpToDateStep(org.gradle.internal.execution.steps.SkipUpToDateStep) ArtifactCacheLockingManager(org.gradle.api.internal.artifacts.ivyservice.ArtifactCacheLockingManager) ExecutionStateChangeDetector(org.gradle.internal.execution.history.changes.ExecutionStateChangeDetector) AtomicReference(java.util.concurrent.atomic.AtomicReference) ReadOnlyModuleVersionsCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.dynamicversions.ReadOnlyModuleVersionsCache) AbstractModuleMetadataCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.AbstractModuleMetadataCache) TemporaryFileProvider(org.gradle.api.internal.file.temp.TemporaryFileProvider) Deleter(org.gradle.internal.file.Deleter) RepositoryTransport(org.gradle.api.internal.artifacts.repositories.transport.RepositoryTransport) FileCollectionFactory(org.gradle.api.internal.file.FileCollectionFactory) DependencyNotationParser(org.gradle.api.internal.notations.DependencyNotationParser) ExecutionHistoryStore(org.gradle.internal.execution.history.ExecutionHistoryStore) ByUrlCachedExternalResourceIndex(org.gradle.internal.resource.cached.ByUrlCachedExternalResourceIndex) InMemoryCacheDecoratorFactory(org.gradle.cache.internal.InMemoryCacheDecoratorFactory) DependenciesAccessors(org.gradle.initialization.DependenciesAccessors) RepositoryTransportFactory(org.gradle.api.internal.artifacts.repositories.transport.RepositoryTransportFactory) ModuleComponentArtifactMetadata(org.gradle.internal.component.external.model.ModuleComponentArtifactMetadata) ValidationFinishedContext(org.gradle.internal.execution.steps.ValidationFinishedContext) CaptureStateBeforeExecutionStep(org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep) ModuleExclusions(org.gradle.api.internal.artifacts.ivyservice.resolveengine.excludes.ModuleExclusions) CachingVersionSelectorScheme(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.CachingVersionSelectorScheme) ComponentMetadataRuleExecutor(org.gradle.internal.resolve.caching.ComponentMetadataRuleExecutor) InstantiatorFactory(org.gradle.internal.instantiation.InstantiatorFactory) TwoStageArtifactIdentifierFileStore(org.gradle.api.internal.filestore.TwoStageArtifactIdentifierFileStore) DefaultDependencyResolutionManagement(org.gradle.internal.management.DefaultDependencyResolutionManagement) MetadataFileSource(org.gradle.api.internal.artifacts.repositories.metadata.MetadataFileSource) CachingContext(org.gradle.internal.execution.steps.CachingContext) ModuleComponentResolveMetadataSerializer(org.gradle.api.internal.artifacts.ivyservice.modulecache.ModuleComponentResolveMetadataSerializer) VersionSelectorScheme(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.VersionSelectorScheme) SimpleMapInterner(org.gradle.util.internal.SimpleMapInterner) DefaultExternalResourceFileStore(org.gradle.internal.resource.cached.DefaultExternalResourceFileStore) FileResolver(org.gradle.api.internal.file.FileResolver) DependenciesAccessorsWorkspaceProvider(org.gradle.api.internal.catalog.DependenciesAccessorsWorkspaceProvider) TransformationNodeDependencyResolver(org.gradle.api.internal.artifacts.transform.TransformationNodeDependencyResolver) GradleProperties(org.gradle.api.internal.properties.GradleProperties) Collections(java.util.Collections) InMemoryModuleArtifactCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.InMemoryModuleArtifactCache) ReadOnlyModuleArtifactCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.ReadOnlyModuleArtifactCache) DefaultModuleArtifactCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.DefaultModuleArtifactCache) ModuleArtifactCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.ModuleArtifactCache) TwoStageModuleArtifactCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.TwoStageModuleArtifactCache) InMemoryModuleArtifactsCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.InMemoryModuleArtifactsCache) InMemoryModuleVersionsCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.dynamicversions.InMemoryModuleVersionsCache) InMemoryModuleMetadataCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.InMemoryModuleMetadataCache) AtomicReference(java.util.concurrent.atomic.AtomicReference) TwoStageModuleArtifactCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.TwoStageModuleArtifactCache) ModuleRepositoryCaches(org.gradle.api.internal.artifacts.ivyservice.modulecache.ModuleRepositoryCaches) TwoStageArtifactsCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.TwoStageArtifactsCache) AbstractModuleVersionsCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.dynamicversions.AbstractModuleVersionsCache) TwoStageModuleVersionsCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.dynamicversions.TwoStageModuleVersionsCache) AbstractArtifactsCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.AbstractArtifactsCache) AbstractModuleMetadataCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.AbstractModuleMetadataCache) InMemoryModuleArtifactCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.artifacts.InMemoryModuleArtifactCache) ModuleRepositoryCacheProvider(org.gradle.api.internal.artifacts.ivyservice.modulecache.ModuleRepositoryCacheProvider) TwoStageModuleMetadataCache(org.gradle.api.internal.artifacts.ivyservice.modulecache.TwoStageModuleMetadataCache)

Example 2 with ChecksumService

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);
                    }
                });
            }
        }
    });
}
Also used : ConsoleRenderer(org.gradle.internal.logging.ConsoleRenderer) DependencyVerifyingModuleComponentRepository(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DependencyVerifyingModuleComponentRepository) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Multimap(com.google.common.collect.Multimap) Deque(java.util.Deque) ChecksumService(org.gradle.internal.hash.ChecksumService) Logger(org.gradle.api.logging.Logger) DependencyVerificationReportWriter(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.verification.report.DependencyVerificationReportWriter) VerificationReport(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.verification.report.VerificationReport) UncheckedException(org.gradle.internal.UncheckedException) RunnableBuildOperation(org.gradle.internal.operations.RunnableBuildOperation) ModuleComponentRepository(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ModuleComponentRepository) ResolvedVariantResult(org.gradle.api.artifacts.result.ResolvedVariantResult) DependencyVerificationException(org.gradle.api.internal.artifacts.verification.DependencyVerificationException) BuildTreeDefinedKeys(org.gradle.api.internal.artifacts.verification.signatures.BuildTreeDefinedKeys) URI(java.net.URI) LinkedHashMultimap(com.google.common.collect.LinkedHashMultimap) Artifact(org.gradle.api.component.Artifact) SignatureVerificationService(org.gradle.api.internal.artifacts.verification.signatures.SignatureVerificationService) DependencyVerificationsXmlReader(org.gradle.api.internal.artifacts.verification.serializer.DependencyVerificationsXmlReader) Collection(java.util.Collection) SignatureVerificationServiceFactory(org.gradle.api.internal.artifacts.verification.signatures.SignatureVerificationServiceFactory) DependencyVerifier(org.gradle.api.internal.artifacts.verification.verifier.DependencyVerifier) Set(java.util.Set) FileInputStream(java.io.FileInputStream) ComponentArtifactIdentifier(org.gradle.api.artifacts.component.ComponentArtifactIdentifier) DocumentationRegistry(org.gradle.api.internal.DocumentationRegistry) BuildOperationDescriptor(org.gradle.internal.operations.BuildOperationDescriptor) Sets(com.google.common.collect.Sets) File(java.io.File) FileNotFoundException(java.io.FileNotFoundException) ResolutionStrategyInternal(org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal) Queues(com.google.common.collect.Queues) List(java.util.List) Stoppable(org.gradle.internal.concurrent.Stoppable) BuildOperationExecutor(org.gradle.internal.operations.BuildOperationExecutor) Logging(org.gradle.api.logging.Logging) Factory(org.gradle.internal.Factory) ModuleComponentArtifactIdentifier(org.gradle.internal.component.external.model.ModuleComponentArtifactIdentifier) BuildOperationContext(org.gradle.internal.operations.BuildOperationContext) GradleProperties(org.gradle.api.internal.properties.GradleProperties) ResolvedArtifactResult(org.gradle.api.artifacts.result.ResolvedArtifactResult) DependencyVerificationMode(org.gradle.api.artifacts.verification.DependencyVerificationMode) BuildOperationContext(org.gradle.internal.operations.BuildOperationContext) RunnableBuildOperation(org.gradle.internal.operations.RunnableBuildOperation)

Example 3 with ChecksumService

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);
}
Also used : ModuleComponentArtifactMetadata(org.gradle.internal.component.external.model.ModuleComponentArtifactMetadata) LocallyAvailableResourceFinder(org.gradle.internal.resource.local.LocallyAvailableResourceFinder) FileStoreSearcher(org.gradle.internal.resource.local.FileStoreSearcher) LocallyAvailableResourceFinderSearchableFileStoreAdapter(org.gradle.internal.resource.local.LocallyAvailableResourceFinderSearchableFileStoreAdapter) Logger(org.slf4j.Logger) M2ResourcePattern(org.gradle.api.internal.artifacts.repositories.resolver.M2ResourcePattern) CannotLocateLocalMavenRepositoryException(org.gradle.api.internal.artifacts.mvnsettings.CannotLocateLocalMavenRepositoryException) LoggerFactory(org.slf4j.LoggerFactory) LocalMavenRepositoryLocator(org.gradle.api.internal.artifacts.mvnsettings.LocalMavenRepositoryLocator) IvyResourcePattern(org.gradle.api.internal.artifacts.repositories.resolver.IvyResourcePattern) ChecksumService(org.gradle.internal.hash.ChecksumService) HashCode(org.gradle.internal.hash.HashCode) File(java.io.File) ArtifactCachesProvider(org.gradle.api.internal.artifacts.ivyservice.ArtifactCachesProvider) ResourcePattern(org.gradle.api.internal.artifacts.repositories.resolver.ResourcePattern) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) ArtifactCacheMetadata(org.gradle.api.internal.artifacts.ivyservice.ArtifactCacheMetadata) CompositeLocallyAvailableResourceFinder(org.gradle.internal.resource.local.CompositeLocallyAvailableResourceFinder) Factory(org.gradle.internal.Factory) ModuleComponentArtifactIdentifier(org.gradle.internal.component.external.model.ModuleComponentArtifactIdentifier) LocallyAvailableResourceCandidates(org.gradle.internal.resource.local.LocallyAvailableResourceCandidates) LocallyAvailableResource(org.gradle.internal.resource.local.LocallyAvailableResource) LinkedList(java.util.LinkedList) M2ResourcePattern(org.gradle.api.internal.artifacts.repositories.resolver.M2ResourcePattern) LocallyAvailableResourceFinder(org.gradle.internal.resource.local.LocallyAvailableResourceFinder) CompositeLocallyAvailableResourceFinder(org.gradle.internal.resource.local.CompositeLocallyAvailableResourceFinder) File(java.io.File) CannotLocateLocalMavenRepositoryException(org.gradle.api.internal.artifacts.mvnsettings.CannotLocateLocalMavenRepositoryException) CompositeLocallyAvailableResourceFinder(org.gradle.internal.resource.local.CompositeLocallyAvailableResourceFinder) LinkedList(java.util.LinkedList)

Aggregations

File (java.io.File)3 List (java.util.List)3 ImmutableList (com.google.common.collect.ImmutableList)2 Sets (com.google.common.collect.Sets)2 DocumentationRegistry (org.gradle.api.internal.DocumentationRegistry)2 ArtifactCacheMetadata (org.gradle.api.internal.artifacts.ivyservice.ArtifactCacheMetadata)2 ArtifactCachesProvider (org.gradle.api.internal.artifacts.ivyservice.ArtifactCachesProvider)2 Factory (org.gradle.internal.Factory)2 ModuleComponentArtifactIdentifier (org.gradle.internal.component.external.model.ModuleComponentArtifactIdentifier)2 ChecksumService (org.gradle.internal.hash.ChecksumService)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSortedMap (com.google.common.collect.ImmutableSortedMap)1 LinkedHashMultimap (com.google.common.collect.LinkedHashMultimap)1 Multimap (com.google.common.collect.Multimap)1 Queues (com.google.common.collect.Queues)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 URI (java.net.URI)1 Path (java.nio.file.Path)1 Duration (java.time.Duration)1