Search in sources :

Example 1 with LocallyAvailableResourceFinderSearchableFileStoreAdapter

use of org.gradle.internal.resource.local.LocallyAvailableResourceFinderSearchableFileStoreAdapter 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

ImmutableList (com.google.common.collect.ImmutableList)1 File (java.io.File)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 ArtifactCacheMetadata (org.gradle.api.internal.artifacts.ivyservice.ArtifactCacheMetadata)1 ArtifactCachesProvider (org.gradle.api.internal.artifacts.ivyservice.ArtifactCachesProvider)1 CannotLocateLocalMavenRepositoryException (org.gradle.api.internal.artifacts.mvnsettings.CannotLocateLocalMavenRepositoryException)1 LocalMavenRepositoryLocator (org.gradle.api.internal.artifacts.mvnsettings.LocalMavenRepositoryLocator)1 IvyResourcePattern (org.gradle.api.internal.artifacts.repositories.resolver.IvyResourcePattern)1 M2ResourcePattern (org.gradle.api.internal.artifacts.repositories.resolver.M2ResourcePattern)1 ResourcePattern (org.gradle.api.internal.artifacts.repositories.resolver.ResourcePattern)1 Factory (org.gradle.internal.Factory)1 ModuleComponentArtifactIdentifier (org.gradle.internal.component.external.model.ModuleComponentArtifactIdentifier)1 ModuleComponentArtifactMetadata (org.gradle.internal.component.external.model.ModuleComponentArtifactMetadata)1 ChecksumService (org.gradle.internal.hash.ChecksumService)1 HashCode (org.gradle.internal.hash.HashCode)1 CompositeLocallyAvailableResourceFinder (org.gradle.internal.resource.local.CompositeLocallyAvailableResourceFinder)1 FileStoreSearcher (org.gradle.internal.resource.local.FileStoreSearcher)1 LocallyAvailableResource (org.gradle.internal.resource.local.LocallyAvailableResource)1 LocallyAvailableResourceCandidates (org.gradle.internal.resource.local.LocallyAvailableResourceCandidates)1