Search in sources :

Example 1 with ComponentMetadataSupplier

use of org.gradle.api.artifacts.ComponentMetadataSupplier 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)

Aggregations

ComponentMetadataSupplier (org.gradle.api.artifacts.ComponentMetadataSupplier)1 ComponentMetadataSupplierDetails (org.gradle.api.artifacts.ComponentMetadataSupplierDetails)1 ComponentMetadataAdapter (org.gradle.api.internal.artifacts.repositories.resolver.ComponentMetadataAdapter)1