Package org.gradle.internal.resource.local

Examples of org.gradle.internal.resource.local.LocallyAvailableResource


        this.descriptorParser = ivyXmlModuleDescriptorParser;
    }

    public ModuleDescriptor getModuleDescriptor(ModuleComponentRepository repository, ModuleComponentIdentifier moduleComponentIdentifier) {
        String filePath = getFilePath(repository, moduleComponentIdentifier);
        final LocallyAvailableResource resource = metaDataStore.get(filePath);
        if (resource != null) {
            return parseModuleDescriptorFile(resource.getFile());
        }
        return null;
    }
View Full Code Here


    }

    public CachedMetaData cacheMetaData(ModuleComponentRepository repository, ModuleComponentResolveMetaData metaData) {
        ModuleDescriptor moduleDescriptor = metaData.getDescriptor();
        LOGGER.debug("Recording module descriptor in cache: {} [changing = {}]", moduleDescriptor.getModuleRevisionId(), metaData.isChanging());
        LocallyAvailableResource resource = moduleDescriptorStore.putModuleDescriptor(repository, moduleDescriptor);
        ModuleDescriptorCacheEntry entry = createEntry(metaData, resource.getSha1());
        getCache().put(createKey(repository, metaData.getComponentId()), entry);
        return new DefaultCachedMetaData(entry, null, timeProvider);
    }
View Full Code Here

            if (remoteChecksum == null) {
                remoteChecksum = delegate.getResourceSha1(location);
            }

            if (remoteChecksum != null) {
                LocallyAvailableResource local = localCandidates.findByHashValue(remoteChecksum);
                if (local != null) {
                    LOGGER.info("Found locally available resource with matching checksum: [{}, {}]", location, local.getFile());
                    // TODO - should iterate over each candidate until we successfully copy into the cache
                    return copyToCache(location, fileStore, new CachedExternalResourceAdapter(location, local, delegate, remoteMetaData, remoteChecksum));
                }
            }
        }
View Full Code Here

            } catch (IOException e) {
                throw new ResourceException(String.format("Failed to download resource '%s'.", resource.getName()), e);
            }
            return cacheLockingManager.useCache(String.format("Store %s", resource.getName()), new Factory<LocallyAvailableExternalResource>() {
                public LocallyAvailableExternalResource create() {
                    LocallyAvailableResource cachedResource = fileStore.moveIntoCache(destination);
                    File fileInFileStore = cachedResource.getFile();
                    ExternalResourceMetaData metaData = resource.getMetaData();
                    cachedExternalResourceIndex.store(source.toString(), fileInFileStore, metaData);
                    return new DefaultLocallyAvailableExternalResource(source, cachedResource, metaData);
                }
            });
View Full Code Here

            String rootRelativePath = archiveBuildOutcome.getRootRelativePath();

            // TODO - we are relying on knowledge that the name of the outcome is the task path
            String taskPath = outcome.getName();

            LocallyAvailableResource resource = null;
            if (file.exists()) {
                String filestoreDestination = String.format("%s/%s/%s", fileStorePrefix, taskPath, file.getName());
                resource = fileStore.move(filestoreDestination, file);
            }
View Full Code Here

    private void addFileBuildOutcome(GradleFileBuildOutcome outcome, ProjectOutcomes rootProject, Set<BuildOutcome> translatedOutcomes) {
        if (zipArchiveTypes.contains(outcome.getTypeIdentifier())) {
            File originalFile = outcome.getFile();
            String relativePath = GFileUtils.relativePath(rootProject.getProjectDirectory(), originalFile);

            LocallyAvailableResource resource = null;
            if (originalFile.exists()) {
                String filestoreDestination = String.format("%s/%s/%s", fileStorePrefix, outcome.getTaskPath(), originalFile.getName());
                resource = fileStore.move(filestoreDestination, originalFile);
            }
View Full Code Here

        this.mainResolvers = mainResolvers;
    }

    public LocallyAvailableExternalResource getMetaDataArtifact(ModuleVersionIdentifier moduleVersionIdentifier, ArtifactType artifactType) {
        File resolvedArtifactFile = resolveMetaDataArtifactFile(moduleVersionIdentifier, mainResolvers.getDependencyResolver(), mainResolvers.getArtifactResolver(), artifactType);
        LocallyAvailableResource localResource = new DefaultLocallyAvailableResource(resolvedArtifactFile);
        return new DefaultLocallyAvailableExternalResource(resolvedArtifactFile.toURI(), localResource);
    }
View Full Code Here

import java.io.File;

public abstract class AbstractModuleDescriptorParser implements MetaDataParser {
    public MutableModuleComponentResolveMetaData parseMetaData(DescriptorParseContext ivySettings, File descriptorFile, boolean validate) throws MetaDataParseException {
        LocallyAvailableResource localResource = new DefaultLocallyAvailableResource(descriptorFile);
        LocallyAvailableExternalResource resource = new DefaultLocallyAvailableExternalResource(descriptorFile.toURI(), localResource);
        return parseDescriptor(ivySettings, resource, validate);
    }
View Full Code Here

TOP

Related Classes of org.gradle.internal.resource.local.LocallyAvailableResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.