Search in sources :

Example 1 with MutableModuleSources

use of org.gradle.internal.component.model.MutableModuleSources in project gradle by gradle.

the class DefaultGradleModuleMetadataSource method createModuleSources.

private void createModuleSources(DefaultModuleComponentArtifactMetadata artifactId, LocallyAvailableExternalResource gradleMetadataArtifact, MutableModuleComponentResolveMetadata metaDataFromResource) {
    MutableModuleSources sources = metaDataFromResource.getSources();
    File file = gradleMetadataArtifact.getFile();
    sources.add(new ModuleDescriptorHashModuleSource(checksumService.md5(file), metaDataFromResource.isChanging()));
    sources.add(new DefaultMetadataFileSource(artifactId.getId(), file, findSha1(gradleMetadataArtifact.getMetaData(), file)));
}
Also used : MutableModuleSources(org.gradle.internal.component.model.MutableModuleSources) File(java.io.File) ModuleDescriptorHashModuleSource(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ModuleDescriptorHashModuleSource)

Example 2 with MutableModuleSources

use of org.gradle.internal.component.model.MutableModuleSources in project gradle by gradle.

the class ModuleSourcesSerializer method read.

@Override
public ModuleSources read(Decoder decoder) throws IOException {
    MutableModuleSources sources = new MutableModuleSources();
    int codecId;
    while ((codecId = decoder.readSmallInt()) > 0) {
        sources.add(moduleSourceCodecs.get(codecId).decode(decoder));
    }
    return sources;
}
Also used : MutableModuleSources(org.gradle.internal.component.model.MutableModuleSources)

Example 3 with MutableModuleSources

use of org.gradle.internal.component.model.MutableModuleSources in project gradle by gradle.

the class AbstractRepositoryMetadataSource method parseMetaDataFromArtifact.

@Nullable
private S parseMetaDataFromArtifact(String repositoryName, ComponentResolvers componentResolvers, ModuleComponentIdentifier moduleComponentIdentifier, ExternalResourceArtifactResolver artifactResolver, ResourceAwareResolveResult result) {
    ModuleComponentArtifactMetadata artifact = getMetaDataArtifactFor(moduleComponentIdentifier);
    LocallyAvailableExternalResource metadataArtifact = artifactResolver.resolveArtifact(artifact, result);
    if (metadataArtifact != null) {
        ExternalResourceResolverDescriptorParseContext context = new ExternalResourceResolverDescriptorParseContext(componentResolvers, fileResourceRepository, checksumService);
        MetaDataParser.ParseResult<S> parseResult = parseMetaDataFromResource(moduleComponentIdentifier, metadataArtifact, artifactResolver, context, repositoryName);
        if (parseResult != null) {
            if (parseResult.hasGradleMetadataRedirectionMarker()) {
                if (result instanceof BuildableModuleComponentMetaDataResolveResult) {
                    ((BuildableModuleComponentMetaDataResolveResult) result).redirectToGradleMetadata();
                } else {
                    throw new IllegalStateException("Unexpected Gradle metadata redirection answer");
                }
            }
            S metadata = parseResult.getResult();
            File metadataArtifactFile = metadataArtifact.getFile();
            ExternalResourceMetaData metaData = metadataArtifact.getMetaData();
            MutableModuleSources sources = metadata.getSources();
            sources.add(new DefaultMetadataFileSource(artifact.getId(), metadataArtifactFile, findSha1(metaData, metadataArtifactFile)));
            context.appendSources(sources);
            return metadata;
        }
    }
    return null;
}
Also used : BuildableModuleComponentMetaDataResolveResult(org.gradle.internal.resolve.result.BuildableModuleComponentMetaDataResolveResult) ModuleComponentArtifactMetadata(org.gradle.internal.component.external.model.ModuleComponentArtifactMetadata) LocallyAvailableExternalResource(org.gradle.internal.resource.local.LocallyAvailableExternalResource) MutableModuleSources(org.gradle.internal.component.model.MutableModuleSources) ExternalResourceResolverDescriptorParseContext(org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolverDescriptorParseContext) MetaDataParser(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.MetaDataParser) File(java.io.File) ExternalResourceMetaData(org.gradle.internal.resource.metadata.ExternalResourceMetaData) Nullable(javax.annotation.Nullable)

Aggregations

MutableModuleSources (org.gradle.internal.component.model.MutableModuleSources)3 File (java.io.File)2 Nullable (javax.annotation.Nullable)1 ModuleDescriptorHashModuleSource (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ModuleDescriptorHashModuleSource)1 MetaDataParser (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.MetaDataParser)1 ExternalResourceResolverDescriptorParseContext (org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolverDescriptorParseContext)1 ModuleComponentArtifactMetadata (org.gradle.internal.component.external.model.ModuleComponentArtifactMetadata)1 BuildableModuleComponentMetaDataResolveResult (org.gradle.internal.resolve.result.BuildableModuleComponentMetaDataResolveResult)1 LocallyAvailableExternalResource (org.gradle.internal.resource.local.LocallyAvailableExternalResource)1 ExternalResourceMetaData (org.gradle.internal.resource.metadata.ExternalResourceMetaData)1