Search in sources :

Example 1 with ModuleDescriptorHashModuleSource

use of org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ModuleDescriptorHashModuleSource 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 ModuleDescriptorHashModuleSource

use of org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ModuleDescriptorHashModuleSource in project gradle by gradle.

the class DefaultIvyDescriptorMetadataSource method parseMetaDataFromResource.

@Override
protected MetaDataParser.ParseResult<MutableIvyModuleResolveMetadata> parseMetaDataFromResource(ModuleComponentIdentifier moduleComponentIdentifier, LocallyAvailableExternalResource cachedResource, ExternalResourceArtifactResolver artifactResolver, DescriptorParseContext context, String repoName) {
    MetaDataParser.ParseResult<MutableIvyModuleResolveMetadata> parseResult = metaDataParser.parseMetaData(context, cachedResource);
    MutableIvyModuleResolveMetadata metaData = parseResult.getResult();
    if (metaData != null) {
        metaData.getSources().add(new ModuleDescriptorHashModuleSource(checksumService.md5(cachedResource.getFile()), metaData.isChanging()));
        checkMetadataConsistency(moduleComponentIdentifier, metaData);
    }
    return parseResult;
}
Also used : MetaDataParser(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.MetaDataParser) ModuleDescriptorHashModuleSource(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ModuleDescriptorHashModuleSource) MutableIvyModuleResolveMetadata(org.gradle.internal.component.external.model.ivy.MutableIvyModuleResolveMetadata)

Example 3 with ModuleDescriptorHashModuleSource

use of org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ModuleDescriptorHashModuleSource in project gradle by gradle.

the class DefaultArtifactMetadataSource method create.

@Override
public MutableModuleComponentResolveMetadata create(String repositoryName, ComponentResolvers componentResolvers, ModuleComponentIdentifier moduleComponentIdentifier, ComponentOverrideMetadata prescribedMetaData, ExternalResourceArtifactResolver artifactResolver, BuildableModuleComponentMetaDataResolveResult result) {
    MutableModuleComponentResolveMetadata metaDataFromDefaultArtifact = createMetaDataFromDependencyArtifact(moduleComponentIdentifier, prescribedMetaData, artifactResolver, result);
    if (metaDataFromDefaultArtifact != null) {
        LOGGER.debug("Found artifact but no meta-data for module '{}' in repository '{}', using default meta-data.", moduleComponentIdentifier, repositoryName);
        metaDataFromDefaultArtifact.getSources().add(new ModuleDescriptorHashModuleSource(getDescriptorHash(moduleComponentIdentifier), false));
        return metaDataFromDefaultArtifact;
    }
    return null;
}
Also used : MutableModuleComponentResolveMetadata(org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata) ModuleDescriptorHashModuleSource(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ModuleDescriptorHashModuleSource)

Example 4 with ModuleDescriptorHashModuleSource

use of org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ModuleDescriptorHashModuleSource in project gradle by gradle.

the class DefaultMavenPomMetadataSource method parseMetaDataFromResource.

@Override
protected MetaDataParser.ParseResult<MutableMavenModuleResolveMetadata> parseMetaDataFromResource(ModuleComponentIdentifier moduleComponentIdentifier, LocallyAvailableExternalResource cachedResource, ExternalResourceArtifactResolver artifactResolver, DescriptorParseContext context, String repoName) {
    MetaDataParser.ParseResult<MutableMavenModuleResolveMetadata> parseResult = pomParser.parseMetaData(context, cachedResource);
    MutableMavenModuleResolveMetadata metaData = parseResult.getResult();
    if (metaData != null) {
        if (moduleComponentIdentifier instanceof MavenUniqueSnapshotComponentIdentifier) {
            // Snapshot POMs use -SNAPSHOT instead of the timestamp as version, so validate against the expected id
            MavenUniqueSnapshotComponentIdentifier snapshotComponentIdentifier = (MavenUniqueSnapshotComponentIdentifier) moduleComponentIdentifier;
            checkMetadataConsistency(snapshotComponentIdentifier.getSnapshotComponent(), metaData);
            metaData.setId(snapshotComponentIdentifier);
            metaData.setSnapshotTimestamp(snapshotComponentIdentifier.getTimestamp());
        } else {
            checkMetadataConsistency(moduleComponentIdentifier, metaData);
        }
        MutableMavenModuleResolveMetadata result = MavenResolver.processMetaData(metaData);
        result.getSources().add(new ModuleDescriptorHashModuleSource(checksumService.md5(cachedResource.getFile()), metaData.isChanging()));
        if (validator.isUsableModule(repoName, result, artifactResolver)) {
            return parseResult;
        }
        return null;
    }
    return parseResult;
}
Also used : MutableMavenModuleResolveMetadata(org.gradle.internal.component.external.model.maven.MutableMavenModuleResolveMetadata) MavenUniqueSnapshotComponentIdentifier(org.gradle.api.internal.artifacts.repositories.resolver.MavenUniqueSnapshotComponentIdentifier) MetaDataParser(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.MetaDataParser) ModuleDescriptorHashModuleSource(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ModuleDescriptorHashModuleSource)

Aggregations

ModuleDescriptorHashModuleSource (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ModuleDescriptorHashModuleSource)4 MetaDataParser (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.MetaDataParser)2 File (java.io.File)1 MavenUniqueSnapshotComponentIdentifier (org.gradle.api.internal.artifacts.repositories.resolver.MavenUniqueSnapshotComponentIdentifier)1 MutableModuleComponentResolveMetadata (org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata)1 MutableIvyModuleResolveMetadata (org.gradle.internal.component.external.model.ivy.MutableIvyModuleResolveMetadata)1 MutableMavenModuleResolveMetadata (org.gradle.internal.component.external.model.maven.MutableMavenModuleResolveMetadata)1 MutableModuleSources (org.gradle.internal.component.model.MutableModuleSources)1