Search in sources :

Example 1 with MutableMavenModuleResolveMetadata

use of org.gradle.internal.component.external.model.MutableMavenModuleResolveMetadata in project gradle by gradle.

the class MavenResolver method parseMetaDataFromResource.

protected MutableMavenModuleResolveMetadata parseMetaDataFromResource(ModuleComponentIdentifier moduleComponentIdentifier, LocallyAvailableExternalResource cachedResource, DescriptorParseContext context) {
    MutableMavenModuleResolveMetadata metaData = metaDataParser.parseMetaData(context, cachedResource);
    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);
        // Use the requested id. Currently we're discarding the MavenUniqueSnapshotComponentIdentifier and replacing with DefaultModuleComponentIdentifier as pretty
        // much every consumer of the meta-data is expecting a DefaultModuleComponentIdentifier.
        ModuleComponentIdentifier lossyId = DefaultModuleComponentIdentifier.newId(moduleComponentIdentifier.getGroup(), moduleComponentIdentifier.getModule(), moduleComponentIdentifier.getVersion());
        metaData.setComponentId(lossyId);
        metaData.setSnapshotTimestamp(snapshotComponentIdentifier.getTimestamp());
    } else {
        checkMetadataConsistency(moduleComponentIdentifier, metaData);
    }
    return processMetaData(metaData);
}
Also used : DefaultMutableMavenModuleResolveMetadata(org.gradle.internal.component.external.model.DefaultMutableMavenModuleResolveMetadata) MutableMavenModuleResolveMetadata(org.gradle.internal.component.external.model.MutableMavenModuleResolveMetadata) DefaultModuleComponentIdentifier(org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier)

Aggregations

ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)1 DefaultModuleComponentIdentifier (org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier)1 DefaultMutableMavenModuleResolveMetadata (org.gradle.internal.component.external.model.DefaultMutableMavenModuleResolveMetadata)1 MutableMavenModuleResolveMetadata (org.gradle.internal.component.external.model.MutableMavenModuleResolveMetadata)1