Search in sources :

Example 1 with VirtualComponentIdentifier

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

the class ModuleComponentResolveMetadataSerializer method readPlatformOwners.

private void readPlatformOwners(Decoder decoder, MutableModuleComponentResolveMetadata mutable) throws IOException {
    int len = decoder.readSmallInt();
    if (len > 0) {
        for (int i = 0; i < len; i++) {
            VirtualComponentIdentifier moduleComponentIdentifier = readModuleIdentifier(decoder);
            mutable.belongsTo(moduleComponentIdentifier);
        }
    }
}
Also used : VirtualComponentIdentifier(org.gradle.internal.component.external.model.VirtualComponentIdentifier)

Example 2 with VirtualComponentIdentifier

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

the class NodeState method visitOwners.

/**
 * If a component declares that it belongs to a platform, we add an edge to the platform.
 *
 * @param discoveredEdges the collection of edges for this component
 */
private void visitOwners(Collection<EdgeState> discoveredEdges) {
    ImmutableList<? extends VirtualComponentIdentifier> owners = component.getMetadata().getPlatformOwners();
    if (!owners.isEmpty()) {
        PendingDependenciesVisitor visitor = resolveState.newPendingDependenciesVisitor();
        for (VirtualComponentIdentifier owner : owners) {
            if (owner instanceof ModuleComponentIdentifier) {
                ModuleComponentIdentifier platformId = (ModuleComponentIdentifier) owner;
                final ModuleComponentSelector cs = DefaultModuleComponentSelector.newSelector(platformId.getModuleIdentifier(), platformId.getVersion());
                // There are 2 possibilities here:
                // 1. the "platform" referenced is a real module, in which case we directly add it to the graph
                // 2. the "platform" is a virtual, constructed thing, in which case we add virtual edges to the graph
                addPlatformEdges(discoveredEdges, platformId, cs);
                visitor.markNotPending(platformId.getModuleIdentifier());
            }
        }
        visitor.complete();
    }
}
Also used : DefaultModuleComponentSelector(org.gradle.internal.component.external.model.DefaultModuleComponentSelector) ModuleComponentSelector(org.gradle.api.artifacts.component.ModuleComponentSelector) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) VirtualComponentIdentifier(org.gradle.internal.component.external.model.VirtualComponentIdentifier)

Aggregations

VirtualComponentIdentifier (org.gradle.internal.component.external.model.VirtualComponentIdentifier)2 ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)1 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)1 DefaultModuleComponentSelector (org.gradle.internal.component.external.model.DefaultModuleComponentSelector)1