use of org.gradle.api.artifacts.ModuleVersionIdentifier in project gradle by gradle.
the class ModuleMetadataFileGenerator method writeVariants.
private void writeVariants(PublicationInternal publication, SoftwareComponent component, Map<SoftwareComponent, ComponentData> componentCoordinates, JsonWriter jsonWriter) throws IOException {
boolean started = false;
for (UsageContext usageContext : ((SoftwareComponentInternal) component).getUsages()) {
if (!started) {
jsonWriter.name("variants");
jsonWriter.beginArray();
started = true;
}
writeVariantHostedInThisModule(publication, usageContext, jsonWriter);
}
if (component instanceof ComponentWithVariants) {
for (SoftwareComponent childComponent : ((ComponentWithVariants) component).getVariants()) {
ModuleVersionIdentifier childCoordinates;
if (childComponent instanceof ComponentWithCoordinates) {
childCoordinates = ((ComponentWithCoordinates) childComponent).getCoordinates();
} else {
ComponentData componentData = componentCoordinates.get(childComponent);
childCoordinates = componentData == null ? null : componentData.coordinates;
}
assert childCoordinates != null;
if (childComponent instanceof SoftwareComponentInternal) {
for (UsageContext usageContext : ((SoftwareComponentInternal) childComponent).getUsages()) {
if (!started) {
jsonWriter.name("variants");
jsonWriter.beginArray();
started = true;
}
writeVariantHostedInAnotherModule(publication.getCoordinates(), childCoordinates, usageContext, jsonWriter);
}
}
}
}
if (started) {
jsonWriter.endArray();
}
}
use of org.gradle.api.artifacts.ModuleVersionIdentifier in project gradle by gradle.
the class DefaultMavenPublication method addProjectDependency.
private void addProjectDependency(ProjectDependency dependency, Set<MavenDependencyInternal> dependencies) {
ModuleVersionIdentifier identifier = projectDependencyResolver.resolve(ModuleVersionIdentifier.class, dependency);
dependencies.add(new DefaultMavenDependency(identifier.getGroup(), identifier.getName(), identifier.getVersion(), Collections.<DependencyArtifact>emptyList(), getExcludeRules(dependency)));
}
use of org.gradle.api.artifacts.ModuleVersionIdentifier in project gradle by gradle.
the class DefaultMavenPublication method getArtifactFileName.
private String getArtifactFileName(String classifier, String extension) {
StringBuilder artifactPath = new StringBuilder();
ModuleVersionIdentifier coordinates = getCoordinates();
artifactPath.append(coordinates.getName());
artifactPath.append('-');
artifactPath.append(coordinates.getVersion());
if (GUtil.isTrue(classifier)) {
artifactPath.append('-');
artifactPath.append(classifier);
}
if (GUtil.isTrue(extension)) {
artifactPath.append('.');
artifactPath.append(extension);
}
return artifactPath.toString();
}
Aggregations