use of org.gradle.api.artifacts.component.ComponentIdentifier in project gradle by gradle.
the class ResolvedVariantResultSerializer method read.
@Override
public ResolvedVariantResult read(Decoder decoder) throws IOException {
int index = decoder.readSmallInt();
if (index == -1) {
return null;
}
if (index == read.size()) {
ComponentIdentifier owner = componentIdentifierSerializer.read(decoder);
String variantName = decoder.readString();
AttributeContainer attributes = attributeContainerSerializer.read(decoder);
List<Capability> capabilities = readCapabilities(decoder);
read.add(null);
ResolvedVariantResult externalVariant = read(decoder);
DefaultResolvedVariantResult result = new DefaultResolvedVariantResult(owner, Describables.of(variantName), attributes, capabilities, externalVariant);
this.read.set(index, result);
return result;
}
return read.get(index);
}
use of org.gradle.api.artifacts.component.ComponentIdentifier in project gradle by gradle.
the class ComponentResultSerializer method read.
@Override
public ResolvedGraphComponent read(Decoder decoder) throws IOException {
long resultId = decoder.readSmallLong();
ModuleVersionIdentifier id = idSerializer.read(decoder);
ComponentSelectionReason reason = reasonSerializer.read(decoder);
ComponentIdentifier componentId = componentIdSerializer.read(decoder);
List<ResolvedVariantResult> resolvedVariants = readResolvedVariants(decoder);
String repositoryName = decoder.readNullableString();
return new DetachedComponentResult(resultId, id, reason, componentId, resolvedVariants, repositoryName);
}
use of org.gradle.api.artifacts.component.ComponentIdentifier in project gradle by gradle.
the class AbstractRealisedModuleResolveMetadataSerializationHelper method writeFiles.
protected void writeFiles(Encoder encoder, ImmutableList<? extends ComponentArtifactMetadata> artifacts) throws IOException {
int fileArtifactsCount = (int) artifacts.stream().filter(a -> a instanceof UrlBackedArtifactMetadata).count();
int ivyArtifactsCount = artifacts.size() - fileArtifactsCount;
encoder.writeSmallInt(ivyArtifactsCount);
for (ComponentArtifactMetadata artifact : artifacts) {
if (!(artifact instanceof UrlBackedArtifactMetadata)) {
IvyArtifactName artifactName = artifact.getName();
writeIvyArtifactName(encoder, artifactName);
ComponentIdentifier componentId = artifact.getComponentId();
if (componentId instanceof MavenUniqueSnapshotComponentIdentifier) {
MavenUniqueSnapshotComponentIdentifier uid = (MavenUniqueSnapshotComponentIdentifier) componentId;
encoder.writeNullableString(uid.getTimestamp());
encoder.writeString(uid.getVersion());
} else {
encoder.writeNullableString(null);
}
encoder.writeBoolean(artifact.getAlternativeArtifact().isPresent());
if (artifact.getAlternativeArtifact().isPresent()) {
writeIvyArtifactName(encoder, artifact.getAlternativeArtifact().get().getName());
}
encoder.writeBoolean(artifact.isOptionalArtifact());
}
}
encoder.writeSmallInt(fileArtifactsCount);
for (ComponentArtifactMetadata file : artifacts) {
if (file instanceof UrlBackedArtifactMetadata) {
encoder.writeString(((UrlBackedArtifactMetadata) file).getFileName());
encoder.writeString(((UrlBackedArtifactMetadata) file).getRelativeUrl());
}
}
}
use of org.gradle.api.artifacts.component.ComponentIdentifier in project gradle by gradle.
the class DependencyLockingArtifactVisitor method visitNode.
@Override
public void visitNode(DependencyGraphNode node) {
boolean changing = false;
ComponentIdentifier identifier = node.getOwner().getComponentId();
ComponentResolveMetadata metadata = node.getOwner().getMetadata();
if (metadata != null && metadata.isChanging()) {
changing = true;
}
if (!node.isRoot() && identifier instanceof ModuleComponentIdentifier) {
ModuleComponentIdentifier id = (ModuleComponentIdentifier) identifier;
if (identifier instanceof MavenUniqueSnapshotComponentIdentifier) {
id = ((MavenUniqueSnapshotComponentIdentifier) id).getSnapshotComponent();
}
if (!id.getVersion().isEmpty()) {
if (allResolvedModules.add(id)) {
if (changing) {
addChangingModule(id);
}
if (dependencyLockingState.mustValidateLockState()) {
ModuleComponentIdentifier lockedId = modulesToBeLocked.remove(id.getModuleIdentifier());
if (lockedId == null) {
if (!dependencyLockingState.getIgnoredEntryFilter().isSatisfiedBy(id)) {
extraModules.add(id);
}
} else if (!lockedId.getVersion().equals(id.getVersion()) && !isNodeRejected(node)) {
// Need to check that versions do match, mismatch indicates a force was used
forcedModules.put(lockedId, id.getVersion());
}
}
}
}
}
}
use of org.gradle.api.artifacts.component.ComponentIdentifier in project gradle by gradle.
the class JsonProjectDependencyRenderer method populateModulesWithChildDependencies.
private void populateModulesWithChildDependencies(RenderableDependency dependency, Set<ComponentIdentifier> visited, Set<ModuleIdentifier> modules) {
for (RenderableDependency childDependency : dependency.getChildren()) {
ModuleIdentifier moduleId = getModuleIdentifier(childDependency);
if (moduleId == null) {
continue;
}
modules.add(moduleId);
boolean alreadyVisited = !visited.add((ComponentIdentifier) childDependency.getId());
if (!alreadyVisited) {
populateModulesWithChildDependencies(childDependency, visited, modules);
}
}
}
Aggregations