Search in sources :

Example 1 with FileHasher

use of org.gradle.internal.hash.FileHasher in project gradle by gradle.

the class DefaultSignatureVerificationServiceFactory method create.

@Override
public SignatureVerificationService create(BuildTreeDefinedKeys keyrings, List<URI> keyServers, boolean useKeyServers) {
    boolean refreshKeys = this.refreshKeys || !useKeyServers;
    ExternalResourceRepository repository = transportFactory.createTransport("https", "https", Collections.emptyList(), redirectLocations -> {
    }).getRepository();
    PublicKeyService keyService;
    if (useKeyServers) {
        PublicKeyDownloadService keyDownloadService = new PublicKeyDownloadService(ImmutableList.copyOf(keyServers), repository);
        keyService = new CrossBuildCachingKeyService(cacheRepository, decoratorFactory, buildOperationExecutor, keyDownloadService, timeProvider, refreshKeys);
    } else {
        keyService = EmptyPublicKeyService.getInstance();
    }
    keyService = keyrings.applyTo(keyService);
    File effectiveKeyringsFile = keyrings.getEffectiveKeyringsFile();
    HashCode keyringFileHash = effectiveKeyringsFile != null && effectiveKeyringsFile.exists() ? fileHasher.hash(effectiveKeyringsFile) : NO_KEYRING_FILE_HASH;
    DefaultSignatureVerificationService delegate = new DefaultSignatureVerificationService(keyService);
    return new CrossBuildSignatureVerificationService(delegate, fileHasher, buildScopedCache, decoratorFactory, timeProvider, refreshKeys, useKeyServers, keyringFileHash);
}
Also used : Hashing(org.gradle.internal.hash.Hashing) BuildCommencedTimeProvider(org.gradle.util.internal.BuildCommencedTimeProvider) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) FileHasher(org.gradle.internal.hash.FileHasher) UncheckedException(org.gradle.internal.UncheckedException) ImmutableList(com.google.common.collect.ImmutableList) PublicKeyService(org.gradle.security.internal.PublicKeyService) BuildScopedCache(org.gradle.cache.scopes.BuildScopedCache) PGPPublicKeyRing(org.bouncycastle.openpgp.PGPPublicKeyRing) InMemoryCacheDecoratorFactory(org.gradle.cache.internal.InMemoryCacheDecoratorFactory) PublicKeyDownloadService(org.gradle.security.internal.PublicKeyDownloadService) URI(java.net.URI) Fingerprint(org.gradle.security.internal.Fingerprint) PGPException(org.bouncycastle.openpgp.PGPException) RepositoryTransportFactory(org.gradle.api.internal.artifacts.repositories.transport.RepositoryTransportFactory) Scopes(org.gradle.internal.service.scopes.Scopes) PGPSignatureList(org.bouncycastle.openpgp.PGPSignatureList) PublicKeyResultBuilder(org.gradle.security.internal.PublicKeyResultBuilder) SecuritySupport.toLongIdHexString(org.gradle.security.internal.SecuritySupport.toLongIdHexString) ExternalResourceRepository(org.gradle.internal.resource.ExternalResourceRepository) PGPSignature(org.bouncycastle.openpgp.PGPSignature) Set(java.util.Set) PGPPublicKey(org.bouncycastle.openpgp.PGPPublicKey) IOException(java.io.IOException) ServiceScope(org.gradle.internal.service.scopes.ServiceScope) HashCode(org.gradle.internal.hash.HashCode) File(java.io.File) UncheckedIOException(java.io.UncheckedIOException) List(java.util.List) BuildOperationExecutor(org.gradle.internal.operations.BuildOperationExecutor) SecuritySupport(org.gradle.security.internal.SecuritySupport) GlobalScopedCache(org.gradle.cache.scopes.GlobalScopedCache) EmptyPublicKeyService(org.gradle.security.internal.EmptyPublicKeyService) Collections(java.util.Collections) HashCode(org.gradle.internal.hash.HashCode) PublicKeyService(org.gradle.security.internal.PublicKeyService) EmptyPublicKeyService(org.gradle.security.internal.EmptyPublicKeyService) PublicKeyDownloadService(org.gradle.security.internal.PublicKeyDownloadService) File(java.io.File) ExternalResourceRepository(org.gradle.internal.resource.ExternalResourceRepository)

Example 2 with FileHasher

use of org.gradle.internal.hash.FileHasher in project gradle by gradle.

the class DefaultFileOperations method createSimple.

public static DefaultFileOperations createSimple(FileResolver fileResolver, FileCollectionFactory fileTreeFactory, ServiceRegistry services) {
    Instantiator instantiator = services.get(Instantiator.class);
    ObjectFactory objectFactory = services.get(ObjectFactory.class);
    FileSystem fileSystem = services.get(FileSystem.class);
    DirectoryFileTreeFactory directoryFileTreeFactory = services.get(DirectoryFileTreeFactory.class);
    StreamHasher streamHasher = services.get(StreamHasher.class);
    FileHasher fileHasher = services.get(FileHasher.class);
    ApiTextResourceAdapter.Factory textResourceAdapterFactory = services.get(ApiTextResourceAdapter.Factory.class);
    Factory<PatternSet> patternSetFactory = services.getFactory(PatternSet.class);
    Deleter deleter = services.get(Deleter.class);
    DocumentationRegistry documentationRegistry = services.get(DocumentationRegistry.class);
    ProviderFactory providers = services.get(ProviderFactory.class);
    DefaultResourceHandler.Factory resourceHandlerFactory = DefaultResourceHandler.Factory.from(fileResolver, fileSystem, null, textResourceAdapterFactory);
    return new DefaultFileOperations(fileResolver, null, instantiator, directoryFileTreeFactory, streamHasher, fileHasher, resourceHandlerFactory, fileTreeFactory, objectFactory, fileSystem, patternSetFactory, deleter, documentationRegistry, providers);
}
Also used : Deleter(org.gradle.internal.file.Deleter) Instantiator(org.gradle.internal.reflect.Instantiator) StreamHasher(org.gradle.internal.hash.StreamHasher) FileHasher(org.gradle.internal.hash.FileHasher) ObjectFactory(org.gradle.api.model.ObjectFactory) DirectoryFileTreeFactory(org.gradle.api.internal.file.collections.DirectoryFileTreeFactory) DefaultResourceHandler(org.gradle.api.internal.resources.DefaultResourceHandler) FileSystem(org.gradle.internal.nativeintegration.filesystem.FileSystem) ProviderFactory(org.gradle.api.provider.ProviderFactory) DocumentationRegistry(org.gradle.api.internal.DocumentationRegistry) ApiTextResourceAdapter(org.gradle.api.internal.resources.ApiTextResourceAdapter) PatternSet(org.gradle.api.tasks.util.PatternSet)

Aggregations

FileHasher (org.gradle.internal.hash.FileHasher)2 ImmutableList (com.google.common.collect.ImmutableList)1 File (java.io.File)1 IOException (java.io.IOException)1 UncheckedIOException (java.io.UncheckedIOException)1 URI (java.net.URI)1 Collections (java.util.Collections)1 List (java.util.List)1 Set (java.util.Set)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 PGPException (org.bouncycastle.openpgp.PGPException)1 PGPPublicKey (org.bouncycastle.openpgp.PGPPublicKey)1 PGPPublicKeyRing (org.bouncycastle.openpgp.PGPPublicKeyRing)1 PGPSignature (org.bouncycastle.openpgp.PGPSignature)1 PGPSignatureList (org.bouncycastle.openpgp.PGPSignatureList)1 DocumentationRegistry (org.gradle.api.internal.DocumentationRegistry)1 RepositoryTransportFactory (org.gradle.api.internal.artifacts.repositories.transport.RepositoryTransportFactory)1 DirectoryFileTreeFactory (org.gradle.api.internal.file.collections.DirectoryFileTreeFactory)1 ApiTextResourceAdapter (org.gradle.api.internal.resources.ApiTextResourceAdapter)1 DefaultResourceHandler (org.gradle.api.internal.resources.DefaultResourceHandler)1