Search in sources :

Example 1 with ComponentMetadataAdapter

use of org.gradle.api.internal.artifacts.repositories.resolver.ComponentMetadataAdapter 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 ComponentMetadataAdapter

use of org.gradle.api.internal.artifacts.repositories.resolver.ComponentMetadataAdapter 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)2 ComponentMetadataAdapter (org.gradle.api.internal.artifacts.repositories.resolver.ComponentMetadataAdapter)2 Nullable (javax.annotation.Nullable)1 ComponentMetadata (org.gradle.api.artifacts.ComponentMetadata)1 ComponentMetadataSupplier (org.gradle.api.artifacts.ComponentMetadataSupplier)1