use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class DefaultArtifactPublisher method isValidToPublish.
private boolean isValidToPublish(PublishArtifact artifact) {
File artifactFile = artifact.getFile();
if (artifactFile.isDirectory()) {
throw new IllegalArgumentException("Cannot publish a directory (" + artifactFile + ")");
}
if (artifactFile.exists()) {
return true;
}
IvyArtifactName ivyArtifactName = DefaultIvyArtifactName.forPublishArtifact(artifact);
if (!isSigningArtifact(ivyArtifactName)) {
throw new PublishException(String.format("Cannot publish artifact '%s' (%s) as it does not exist.", ivyArtifactName, artifactFile));
}
return false;
}
use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class DefaultIvyModuleDescriptorWriter method printDependency.
protected void printDependency(LocalOriginDependencyMetadata dep, SimpleXmlWriter writer) throws IOException {
writer.startElement("dependency");
ModuleVersionSelector requested = componentSelectorConverter.getSelector(dep.getSelector());
writer.attribute("org", requested.getGroup());
writer.attribute("name", requested.getName());
writer.attribute("rev", requested.getVersion());
if (dep.isForce()) {
writer.attribute("force", "true");
}
if (dep.isChanging()) {
writer.attribute("changing", "true");
}
if (!dep.isTransitive()) {
writer.attribute("transitive", "false");
}
writer.attribute("conf", getConfMapping(dep));
for (IvyArtifactName dependencyArtifact : dep.getArtifacts()) {
printDependencyArtifact(writer, dependencyArtifact, dep.getModuleConfiguration());
}
printDependencyExcludeRules(writer, dep.getExcludes());
writer.endElement();
}
use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class DefaultIvyModuleDescriptorWriter method printDependencyExcludeRules.
private static void printDependencyExcludeRules(SimpleXmlWriter writer, Collection<ExcludeMetadata> excludes) throws IOException {
for (ExcludeMetadata exclude : excludes) {
writer.startElement("exclude");
writer.attribute("org", exclude.getModuleId().getGroup());
writer.attribute("module", exclude.getModuleId().getName());
IvyArtifactName artifact = exclude.getArtifact();
if (artifact != null) {
writer.attribute("name", artifact.getName());
writer.attribute("type", artifact.getType());
writer.attribute("ext", artifact.getExtension());
}
writer.endElement();
}
}
use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class AbstractRealisedModuleResolveMetadataSerializationHelper method readDependencyMetadata.
protected GradleDependencyMetadata readDependencyMetadata(Decoder decoder) throws IOException {
ModuleComponentSelector selector = componentSelectorSerializer.read(decoder);
List<ExcludeMetadata> excludes = readMavenExcludes(decoder);
boolean constraint = decoder.readBoolean();
boolean endorsing = decoder.readBoolean();
boolean force = decoder.readBoolean();
String reason = decoder.readNullableString();
IvyArtifactName artifact = readNullableArtifact(decoder);
return new GradleDependencyMetadata(selector, excludes, constraint, endorsing, reason, force, artifact);
}
use of org.gradle.internal.component.model.IvyArtifactName 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());
}
}
}
Aggregations