use of org.gradle.api.publish.maven.internal.dependencies.MavenDependencyInternal in project gradle by gradle.
the class GenerateMavenPom method doGenerate.
@TaskAction
public void doGenerate() {
MavenPomInternal pomInternal = (MavenPomInternal) getPom();
MavenPomFileGenerator pomGenerator = new MavenPomFileGenerator(pomInternal.getProjectIdentity(), getVersionRangeMapper());
pomGenerator.setPackaging(pomInternal.getPackaging());
for (MavenDependencyInternal runtimeDependency : pomInternal.getApiDependencies()) {
pomGenerator.addApiDependency(runtimeDependency);
}
for (MavenDependencyInternal runtimeDependency : pomInternal.getRuntimeDependencies()) {
pomGenerator.addRuntimeDependency(runtimeDependency);
}
pomGenerator.withXml(pomInternal.getXmlAction());
pomGenerator.writeTo(getDestination());
}
use of org.gradle.api.publish.maven.internal.dependencies.MavenDependencyInternal in project gradle by gradle.
the class DefaultMavenPublication method from.
public void from(SoftwareComponent component) {
if (this.component != null) {
throw new InvalidUserDataException(String.format("Maven publication '%s' cannot include multiple components", name));
}
this.component = (SoftwareComponentInternal) component;
Set<PublishArtifact> seenArtifacts = Sets.newHashSet();
Set<ModuleDependency> seenDependencies = Sets.newHashSet();
for (UsageContext usageContext : getSortedUsageContexts()) {
// TODO Need a smarter way to map usage to artifact classifier
for (PublishArtifact publishArtifact : usageContext.getArtifacts()) {
if (seenArtifacts.add(publishArtifact)) {
artifact(publishArtifact);
}
}
Set<MavenDependencyInternal> dependencies = dependenciesFor(usageContext.getUsage());
for (ModuleDependency dependency : usageContext.getDependencies()) {
if (seenDependencies.add(dependency)) {
if (dependency instanceof ProjectDependency) {
addProjectDependency((ProjectDependency) dependency, dependencies);
} else {
addModuleDependency(dependency, dependencies);
}
}
}
}
}
Aggregations