Search in sources :

Example 1 with ComponentMetadataSupplierDetails

use of org.gradle.api.artifacts.ComponentMetadataSupplierDetails in project gradle by gradle.

the class MetadataProvider method getComponentMetadata.

public ComponentMetadata getComponentMetadata() {
    ComponentMetadataSupplier componentMetadataSupplier = resolveState == null ? null : resolveState.getComponentMetadataSupplier();
    if (componentMetadataSupplier != null) {
        final SimpleComponentMetadataBuilder builder = new SimpleComponentMetadataBuilder(DefaultModuleVersionIdentifier.newId(resolveState.getId()));
        ComponentMetadataSupplierDetails details = new ComponentMetadataSupplierDetails() {

            @Override
            public ModuleComponentIdentifier getId() {
                return resolveState.getId();
            }

            @Override
            public ComponentMetadataBuilder getResult() {
                return builder;
            }
        };
        componentMetadataSupplier.execute(details);
        if (builder.mutated) {
            return builder.build();
        }
    }
    if (resolve()) {
        return new ComponentMetadataAdapter(getMetaData());
    }
    return null;
}
Also used : ComponentMetadataSupplier(org.gradle.api.artifacts.ComponentMetadataSupplier) ComponentMetadataSupplierDetails(org.gradle.api.artifacts.ComponentMetadataSupplierDetails) ComponentMetadataAdapter(org.gradle.api.internal.artifacts.repositories.resolver.ComponentMetadataAdapter)

Example 2 with ComponentMetadataSupplierDetails

use of org.gradle.api.artifacts.ComponentMetadataSupplierDetails in project gradle by gradle.

the class DefaultMavenArtifactRepository method createResolver.

private MavenResolver createResolver(URI rootUri) {
    RepositoryTransport transport = getTransport(rootUri.getScheme());
    MavenMetadataLoader mavenMetadataLoader = new MavenMetadataLoader(transport.getResourceAccessor(), resourcesFileStore);
    ImmutableMetadataSources metadataSources = createMetadataSources(mavenMetadataLoader);
    Instantiator injector = createInjectorForMetadataSuppliers(transport, instantiatorFactory, getUrl(), resourcesFileStore);
    InstantiatingAction<ComponentMetadataSupplierDetails> supplier = createComponentMetadataSupplierFactory(injector, isolatableFactory);
    InstantiatingAction<ComponentMetadataListerDetails> lister = createComponentMetadataVersionLister(injector, isolatableFactory);
    return new MavenResolver(getName(), rootUri, transport, locallyAvailableResourceFinder, artifactFileStore, metadataSources, MavenMetadataArtifactProvider.INSTANCE, mavenMetadataLoader, supplier, lister, injector, checksumService);
}
Also used : MavenResolver(org.gradle.api.internal.artifacts.repositories.resolver.MavenResolver) ComponentMetadataSupplierDetails(org.gradle.api.artifacts.ComponentMetadataSupplierDetails) Instantiator(org.gradle.internal.reflect.Instantiator) DefaultImmutableMetadataSources(org.gradle.api.internal.artifacts.repositories.metadata.DefaultImmutableMetadataSources) ImmutableMetadataSources(org.gradle.api.internal.artifacts.repositories.metadata.ImmutableMetadataSources) RepositoryTransport(org.gradle.api.internal.artifacts.repositories.transport.RepositoryTransport) MavenMetadataLoader(org.gradle.api.internal.artifacts.repositories.maven.MavenMetadataLoader) ComponentMetadataListerDetails(org.gradle.api.artifacts.ComponentMetadataListerDetails)

Example 3 with ComponentMetadataSupplierDetails

use of org.gradle.api.artifacts.ComponentMetadataSupplierDetails in project gradle by gradle.

the class DefaultIvyArtifactRepository method createResolver.

private IvyResolver createResolver(RepositoryTransport transport) {
    Instantiator injector = createInjectorForMetadataSuppliers(transport, instantiatorFactory, getUrl(), externalResourcesFileStore);
    InstantiatingAction<ComponentMetadataSupplierDetails> supplierFactory = createComponentMetadataSupplierFactory(injector, isolatableFactory);
    InstantiatingAction<ComponentMetadataListerDetails> listerFactory = createComponentMetadataVersionLister(injector, isolatableFactory);
    return new IvyResolver(getName(), transport, locallyAvailableResourceFinder, metaDataProvider.dynamicResolve, artifactFileStore, supplierFactory, listerFactory, createMetadataSources(), IvyMetadataArtifactProvider.INSTANCE, injector, checksumService);
}
Also used : ComponentMetadataSupplierDetails(org.gradle.api.artifacts.ComponentMetadataSupplierDetails) IvyResolver(org.gradle.api.internal.artifacts.repositories.resolver.IvyResolver) Instantiator(org.gradle.internal.reflect.Instantiator) ComponentMetadataListerDetails(org.gradle.api.artifacts.ComponentMetadataListerDetails)

Example 4 with ComponentMetadataSupplierDetails

use of org.gradle.api.artifacts.ComponentMetadataSupplierDetails in project gradle by gradle.

the class DefaultMetadataProvider method getComponentMetadataFromSupplier.

private ComponentMetadata getComponentMetadataFromSupplier(InstantiatingAction<ComponentMetadataSupplierDetails> componentMetadataSupplier) {
    ComponentMetadata metadata;
    ModuleVersionIdentifier id = DefaultModuleVersionIdentifier.newId(resolveState.getId());
    metadata = resolveState.getComponentMetadataSupplierExecutor().execute(id, componentMetadataSupplier, TO_COMPONENT_METADATA, id1 -> {
        final SimpleComponentMetadataBuilder builder = new SimpleComponentMetadataBuilder(id1, resolveState.getAttributesFactory());
        return new BuildableComponentMetadataSupplierDetails(builder);
    }, resolveState.getCachePolicy());
    return metadata;
}
Also used : ModuleVersionIdentifier(org.gradle.api.artifacts.ModuleVersionIdentifier) DefaultModuleVersionIdentifier(org.gradle.api.internal.artifacts.DefaultModuleVersionIdentifier) DefaultIvyModuleDescriptor(org.gradle.api.internal.artifacts.ivyservice.DefaultIvyModuleDescriptor) IvyModuleDescriptor(org.gradle.api.artifacts.ivy.IvyModuleDescriptor) ComponentMetadataSupplierDetails(org.gradle.api.artifacts.ComponentMetadataSupplierDetails) CachePolicy(org.gradle.api.internal.artifacts.configurations.dynamicversion.CachePolicy) MavenVersionUtils(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.MavenVersionUtils) Lists(com.google.common.collect.Lists) ComponentMetadataAdapter(org.gradle.api.internal.artifacts.repositories.resolver.ComponentMetadataAdapter) ModuleVersionIdentifier(org.gradle.api.artifacts.ModuleVersionIdentifier) AttributeContainer(org.gradle.api.attributes.AttributeContainer) Attribute(org.gradle.api.attributes.Attribute) ComponentResolveMetadata(org.gradle.internal.component.model.ComponentResolveMetadata) ModuleComponentResolveMetadata(org.gradle.internal.component.external.model.ModuleComponentResolveMetadata) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) IvyModuleResolveMetadata(org.gradle.internal.component.external.model.ivy.IvyModuleResolveMetadata) DefaultModuleVersionIdentifier(org.gradle.api.internal.artifacts.DefaultModuleVersionIdentifier) ComponentMetadataBuilder(org.gradle.api.artifacts.ComponentMetadataBuilder) ImmutableAttributes(org.gradle.api.internal.attributes.ImmutableAttributes) Nullable(javax.annotation.Nullable) Transformer(org.gradle.api.Transformer) ImmutableAttributesFactory(org.gradle.api.internal.attributes.ImmutableAttributesFactory) MetadataResolutionContext(org.gradle.api.internal.artifacts.MetadataResolutionContext) Action(org.gradle.api.Action) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) Instantiator(org.gradle.internal.reflect.Instantiator) List(java.util.List) ComponentMetadata(org.gradle.api.artifacts.ComponentMetadata) TreeFormatter(org.gradle.internal.logging.text.TreeFormatter) InstantiatingAction(org.gradle.internal.action.InstantiatingAction) BuildableModuleComponentMetaDataResolveResult(org.gradle.internal.resolve.result.BuildableModuleComponentMetaDataResolveResult) InvalidUserDataException(org.gradle.api.InvalidUserDataException) AttributeContainerInternal(org.gradle.api.internal.attributes.AttributeContainerInternal) ComponentMetadata(org.gradle.api.artifacts.ComponentMetadata)

Example 5 with ComponentMetadataSupplierDetails

use of org.gradle.api.artifacts.ComponentMetadataSupplierDetails in project gradle by gradle.

the class DefaultMetadataProvider method computeMetadata.

@Nullable
private ComponentMetadata computeMetadata() {
    ComponentMetadata metadata = null;
    InstantiatingAction<ComponentMetadataSupplierDetails> componentMetadataSupplier = resolveState.getComponentMetadataSupplier();
    if (componentMetadataSupplier != null) {
        metadata = getComponentMetadataFromSupplier(componentMetadataSupplier);
    }
    if (metadata != null) {
        metadata = transformThroughComponentMetadataRules(componentMetadataSupplier, metadata);
    } else if (resolve()) {
        metadata = new ComponentMetadataAdapter(cachedResult.getMetaData());
    }
    return metadata;
}
Also used : ComponentMetadataSupplierDetails(org.gradle.api.artifacts.ComponentMetadataSupplierDetails) ComponentMetadata(org.gradle.api.artifacts.ComponentMetadata) ComponentMetadataAdapter(org.gradle.api.internal.artifacts.repositories.resolver.ComponentMetadataAdapter) Nullable(javax.annotation.Nullable)

Aggregations

ComponentMetadataSupplierDetails (org.gradle.api.artifacts.ComponentMetadataSupplierDetails)5 ComponentMetadataAdapter (org.gradle.api.internal.artifacts.repositories.resolver.ComponentMetadataAdapter)3 Instantiator (org.gradle.internal.reflect.Instantiator)3 Nullable (javax.annotation.Nullable)2 ComponentMetadata (org.gradle.api.artifacts.ComponentMetadata)2 ComponentMetadataListerDetails (org.gradle.api.artifacts.ComponentMetadataListerDetails)2 Lists (com.google.common.collect.Lists)1 List (java.util.List)1 Action (org.gradle.api.Action)1 InvalidUserDataException (org.gradle.api.InvalidUserDataException)1 Transformer (org.gradle.api.Transformer)1 ComponentMetadataBuilder (org.gradle.api.artifacts.ComponentMetadataBuilder)1 ComponentMetadataSupplier (org.gradle.api.artifacts.ComponentMetadataSupplier)1 ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)1 ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)1 IvyModuleDescriptor (org.gradle.api.artifacts.ivy.IvyModuleDescriptor)1 Attribute (org.gradle.api.attributes.Attribute)1 AttributeContainer (org.gradle.api.attributes.AttributeContainer)1 DefaultModuleVersionIdentifier (org.gradle.api.internal.artifacts.DefaultModuleVersionIdentifier)1 MetadataResolutionContext (org.gradle.api.internal.artifacts.MetadataResolutionContext)1