Search in sources :

Example 1 with MutableMavenModuleResolveMetadata

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

the class MavenMutableModuleMetadataFactory method missing.

@Override
public MutableMavenModuleResolveMetadata missing(ModuleComponentIdentifier from) {
    MutableMavenModuleResolveMetadata metadata = create(from, Collections.emptyList());
    metadata.setMissing(true);
    return MavenResolver.processMetaData(metadata);
}
Also used : DefaultMutableMavenModuleResolveMetadata(org.gradle.internal.component.external.model.maven.DefaultMutableMavenModuleResolveMetadata) MutableMavenModuleResolveMetadata(org.gradle.internal.component.external.model.maven.MutableMavenModuleResolveMetadata)

Example 2 with MutableMavenModuleResolveMetadata

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

the class GradlePomModuleDescriptorParser method doParseDescriptor.

@Override
protected ParseResult<MutableMavenModuleResolveMetadata> doParseDescriptor(DescriptorParseContext parserSettings, LocallyAvailableExternalResource resource, boolean validate) throws IOException, ParseException, SAXException {
    PomReader pomReader = new PomReader(resource, moduleIdentifierFactory);
    GradlePomModuleDescriptorBuilder mdBuilder = new GradlePomModuleDescriptorBuilder(pomReader, gradleVersionSelectorScheme, mavenVersionSelectorScheme);
    doParsePom(parserSettings, mdBuilder, pomReader);
    List<MavenDependencyDescriptor> dependencies = mdBuilder.getDependencies();
    ModuleComponentIdentifier cid = mdBuilder.getComponentIdentifier();
    MutableMavenModuleResolveMetadata metadata = metadataFactory.create(cid, dependencies);
    metadata.setStatus(mdBuilder.getStatus());
    if (pomReader.getRelocation() != null) {
        metadata.setPackaging("pom");
        metadata.setRelocated(true);
    } else {
        metadata.setPackaging(pomReader.getPackaging());
        metadata.setRelocated(false);
    }
    return ParseResult.of(metadata, pomReader.hasGradleMetadataMarker());
}
Also used : MutableMavenModuleResolveMetadata(org.gradle.internal.component.external.model.maven.MutableMavenModuleResolveMetadata) MavenDependencyDescriptor(org.gradle.internal.component.external.model.maven.MavenDependencyDescriptor) DefaultModuleComponentIdentifier(org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier)

Example 3 with MutableMavenModuleResolveMetadata

use of org.gradle.internal.component.external.model.maven.MutableMavenModuleResolveMetadata 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

MutableMavenModuleResolveMetadata (org.gradle.internal.component.external.model.maven.MutableMavenModuleResolveMetadata)3 ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)1 ModuleDescriptorHashModuleSource (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ModuleDescriptorHashModuleSource)1 MetaDataParser (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.MetaDataParser)1 MavenUniqueSnapshotComponentIdentifier (org.gradle.api.internal.artifacts.repositories.resolver.MavenUniqueSnapshotComponentIdentifier)1 DefaultModuleComponentIdentifier (org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier)1 DefaultMutableMavenModuleResolveMetadata (org.gradle.internal.component.external.model.maven.DefaultMutableMavenModuleResolveMetadata)1 MavenDependencyDescriptor (org.gradle.internal.component.external.model.maven.MavenDependencyDescriptor)1