use of org.gradle.api.artifacts.DependencyArtifact in project gradle by gradle.
the class AbstractModuleDependency method artifact.
@Override
public DependencyArtifact artifact(Action<? super DependencyArtifact> configureAction) {
DependencyArtifact artifact = new DefaultDependencyArtifact();
configureAction.execute(artifact);
artifacts.add(artifact);
return artifact;
}
use of org.gradle.api.artifacts.DependencyArtifact 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.DependencyArtifact in project gradle by gradle.
the class ModuleMetadataSpecBuilder method dependenciesOf.
private List<ModuleMetadataSpec.Dependency> dependenciesOf(UsageContext variant) {
if (variant.getDependencies().isEmpty()) {
return emptyList();
}
ArrayList<ModuleMetadataSpec.Dependency> dependencies = new ArrayList<>();
Set<ExcludeRule> additionalExcludes = variant.getGlobalExcludes();
VariantVersionMappingStrategyInternal versionMappingStrategy = versionMappingStrategyFor(variant);
for (ModuleDependency moduleDependency : variant.getDependencies()) {
if (moduleDependency.getArtifacts().isEmpty()) {
dependencies.add(dependencyFor(moduleDependency, additionalExcludes, versionMappingStrategy, null, variant.getName()));
} else {
for (DependencyArtifact dependencyArtifact : moduleDependency.getArtifacts()) {
dependencies.add(dependencyFor(moduleDependency, additionalExcludes, versionMappingStrategy, dependencyArtifact, variant.getName()));
}
}
}
return dependencies;
}
use of org.gradle.api.artifacts.DependencyArtifact in project gradle by gradle.
the class IvyDescriptorFileGenerator method writeDependencies.
private void writeDependencies(OptionalAttributeXmlWriter xmlWriter) throws IOException {
xmlWriter.startElement("dependencies");
for (IvyDependencyInternal dependency : dependencies) {
String org = dependency.getOrganisation();
String module = dependency.getModule();
String projectPath = dependency.getProjectPath();
ModuleVersionIdentifier resolvedVersion = versionMappingStrategy.findStrategyForVariant(dependency.getAttributes()).maybeResolveVersion(org, module, projectPath);
if (resolvedVersion != null) {
org = resolvedVersion.getGroup();
module = resolvedVersion.getName();
}
xmlWriter.startElement("dependency").attribute("org", org).attribute("name", module).attribute("rev", resolvedVersion != null ? resolvedVersion.getVersion() : dependency.getRevision()).attribute("conf", dependency.getConfMapping());
if (resolvedVersion != null && isDynamicVersion(dependency.getRevision())) {
xmlWriter.attribute("revConstraint", dependency.getRevision());
}
if (!dependency.isTransitive()) {
xmlWriter.attribute("transitive", "false");
}
for (DependencyArtifact dependencyArtifact : dependency.getArtifacts()) {
printDependencyArtifact(dependencyArtifact, xmlWriter);
}
for (ExcludeRule excludeRule : dependency.getExcludeRules()) {
writeDependencyExclude(excludeRule, xmlWriter);
}
xmlWriter.endElement();
}
for (IvyExcludeRule excludeRule : globalExcludes) {
writeGlobalExclude(excludeRule, xmlWriter);
}
xmlWriter.endElement();
}
use of org.gradle.api.artifacts.DependencyArtifact in project gradle by gradle.
the class DefaultDependencyArtifactTest method testInit.
@Test
public void testInit() {
String testName = "name";
String testType = "type";
String testExtension = "ext";
String testClassifier = "classifier";
String testUrl = "url";
DependencyArtifact artifact = new DefaultDependencyArtifact(testName, testType, testExtension, testClassifier, testUrl);
assertEquals(testName, artifact.getName());
assertEquals(testType, artifact.getType());
assertEquals(testExtension, artifact.getExtension());
assertEquals(testClassifier, artifact.getClassifier());
assertEquals(testUrl, artifact.getUrl());
}
Aggregations