Search in sources :

Example 1 with ModuleComponentResolveMetadata

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

the class ClientModuleResolver method resolve.

public void resolve(ComponentIdentifier identifier, ComponentOverrideMetadata componentOverrideMetadata, BuildableComponentResolveResult result) {
    resolver.resolve(identifier, componentOverrideMetadata, result);
    if (result.getFailure() != null) {
        return;
    }
    ClientModule clientModule = componentOverrideMetadata.getClientModule();
    if (clientModule != null) {
        MutableModuleComponentResolveMetadata clientModuleMetaData = ((ModuleComponentResolveMetadata) result.getMetaData()).asMutable();
        addClientModuleDependencies(clientModule, clientModuleMetaData);
        setClientModuleArtifact(clientModuleMetaData);
        result.setMetaData(clientModuleMetaData.asImmutable());
    }
}
Also used : MutableModuleComponentResolveMetadata(org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata) MutableModuleComponentResolveMetadata(org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata) ModuleComponentResolveMetadata(org.gradle.internal.component.external.model.ModuleComponentResolveMetadata) ClientModule(org.gradle.api.artifacts.ClientModule)

Example 2 with ModuleComponentResolveMetadata

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

the class DefaultComponentMetadataHandler method processMetadata.

public ModuleComponentResolveMetadata processMetadata(ModuleComponentResolveMetadata metadata) {
    ModuleComponentResolveMetadata updatedMetadata;
    if (rules.isEmpty()) {
        updatedMetadata = metadata;
    } else {
        MutableModuleComponentResolveMetadata mutableMetadata = metadata.asMutable();
        ComponentMetadataDetails details = instantiator.newInstance(ComponentMetadataDetailsAdapter.class, mutableMetadata);
        processAllRules(metadata, details);
        updatedMetadata = mutableMetadata.asImmutable();
    }
    if (!updatedMetadata.getStatusScheme().contains(updatedMetadata.getStatus())) {
        throw new ModuleVersionResolveException(updatedMetadata.getId(), String.format("Unexpected status '%s' specified for %s. Expected one of: %s", updatedMetadata.getStatus(), updatedMetadata.getComponentId().getDisplayName(), updatedMetadata.getStatusScheme()));
    }
    return updatedMetadata;
}
Also used : MutableModuleComponentResolveMetadata(org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata) MutableModuleComponentResolveMetadata(org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata) ModuleComponentResolveMetadata(org.gradle.internal.component.external.model.ModuleComponentResolveMetadata) ModuleVersionResolveException(org.gradle.internal.resolve.ModuleVersionResolveException) ComponentMetadataDetails(org.gradle.api.artifacts.ComponentMetadataDetails)

Example 3 with ModuleComponentResolveMetadata

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

the class CachedModuleVersionResult method supply.

public void supply(BuildableModuleComponentMetaDataResolveResult result) {
    assert isCacheable() : "Results are not cacheable, cannot supply the results.";
    if (state == Resolved) {
        ModuleComponentResolveMetadata metaData = this.metaData;
        result.resolved(metaData);
        result.setAuthoritative(authoritative);
    } else if (state == Missing) {
        result.missing();
        result.setAuthoritative(authoritative);
    }
}
Also used : ModuleComponentResolveMetadata(org.gradle.internal.component.external.model.ModuleComponentResolveMetadata)

Example 4 with ModuleComponentResolveMetadata

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

the class IvyDynamicResolveModuleComponentRepositoryAccess method transformDependencies.

private void transformDependencies(BuildableModuleComponentMetaDataResolveResult result) {
    ModuleComponentResolveMetadata metadata = result.getMetaData();
    MutableModuleComponentResolveMetadata mutableMetadata = metadata.asMutable();
    List<DependencyMetadata> transformed = new ArrayList<DependencyMetadata>();
    for (DependencyMetadata dependency : metadata.getDependencies()) {
        transformed.add(dependency.withRequestedVersion(dependency.getDynamicConstraintVersion()));
    }
    mutableMetadata.setDependencies(transformed);
    result.setMetadata(mutableMetadata.asImmutable());
}
Also used : MutableModuleComponentResolveMetadata(org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata) ModuleComponentResolveMetadata(org.gradle.internal.component.external.model.ModuleComponentResolveMetadata) MutableModuleComponentResolveMetadata(org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata) ArrayList(java.util.ArrayList) DependencyMetadata(org.gradle.internal.component.model.DependencyMetadata)

Aggregations

ModuleComponentResolveMetadata (org.gradle.internal.component.external.model.ModuleComponentResolveMetadata)4 MutableModuleComponentResolveMetadata (org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata)3 ArrayList (java.util.ArrayList)1 ClientModule (org.gradle.api.artifacts.ClientModule)1 ComponentMetadataDetails (org.gradle.api.artifacts.ComponentMetadataDetails)1 DependencyMetadata (org.gradle.internal.component.model.DependencyMetadata)1 ModuleVersionResolveException (org.gradle.internal.resolve.ModuleVersionResolveException)1