Search in sources :

Example 1 with MutableModuleComponentResolveMetadata

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

the class DefaultModuleMetaDataCache method getCachedModuleDescriptor.

public CachedMetaData getCachedModuleDescriptor(ModuleComponentRepository repository, ModuleComponentIdentifier componentId) {
    ModuleComponentAtRepositoryKey key = createKey(repository, componentId);
    ModuleMetadataCacheEntry entry = getCache().get(key);
    if (entry == null) {
        return null;
    }
    if (entry.isMissing()) {
        return new DefaultCachedMetaData(entry, null, timeProvider);
    }
    MutableModuleComponentResolveMetadata metadata = moduleMetadataStore.getModuleDescriptor(key);
    if (metadata == null) {
        // Descriptor file has been deleted - ignore the entry
        getCache().remove(key);
        return null;
    }
    return new DefaultCachedMetaData(entry, entry.configure(metadata), timeProvider);
}
Also used : MutableModuleComponentResolveMetadata(org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata)

Example 2 with MutableModuleComponentResolveMetadata

use of org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata 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 3 with MutableModuleComponentResolveMetadata

use of org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata 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 4 with MutableModuleComponentResolveMetadata

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

Example 5 with MutableModuleComponentResolveMetadata

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

the class ValidatingIvyPublisher method validateMetadata.

private void validateMetadata(IvyNormalizedPublication publication) {
    IvyPublicationIdentity identity = publication.getProjectIdentity();
    IvyFieldValidator organisation = field(publication, "organisation", identity.getOrganisation()).notEmpty().validInFileName();
    IvyFieldValidator moduleName = field(publication, "module name", identity.getModule()).notEmpty().validInFileName();
    IvyFieldValidator revision = field(publication, "revision", identity.getRevision()).notEmpty().validInFileName();
    MutableModuleComponentResolveMetadata metadata = parseIvyFile(publication);
    ModuleVersionIdentifier moduleId = metadata.getId();
    organisation.matches(moduleId.getGroup());
    moduleName.matches(moduleId.getName());
    revision.matches(moduleId.getVersion());
    field(publication, "branch", metadata.getDescriptor().getBranch()).optionalNotEmpty().doesNotContainSpecialCharacters(true);
    field(publication, "status", metadata.getStatus()).optionalNotEmpty().validInFileName();
}
Also used : MutableModuleComponentResolveMetadata(org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata) ModuleVersionIdentifier(org.gradle.api.artifacts.ModuleVersionIdentifier)

Aggregations

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