use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class ExternalResourceResolver method getDependencyArtifactNames.
private Set<IvyArtifactName> getDependencyArtifactNames(String moduleName, Set<IvyArtifactName> artifacts) {
Set<IvyArtifactName> artifactSet = Sets.newLinkedHashSet();
artifactSet.addAll(artifacts);
if (artifactSet.isEmpty()) {
artifactSet.add(new DefaultIvyArtifactName(moduleName, "jar", "jar"));
}
return artifactSet;
}
use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class MutableModuleDescriptorState method createModuleDescriptor.
public static MutableModuleDescriptorState createModuleDescriptor(ModuleComponentIdentifier componentIdentifier, Set<IvyArtifactName> componentArtifacts) {
MutableModuleDescriptorState moduleDescriptorState = new MutableModuleDescriptorState(componentIdentifier);
for (IvyArtifactName artifactName : componentArtifacts) {
moduleDescriptorState.addArtifact(artifactName, Collections.singleton(org.gradle.api.artifacts.Dependency.DEFAULT_CONFIGURATION));
}
if (componentArtifacts.isEmpty()) {
IvyArtifactName defaultArtifact = new DefaultIvyArtifactName(componentIdentifier.getModule(), "jar", "jar");
moduleDescriptorState.addArtifact(defaultArtifact, Collections.singleton(org.gradle.api.artifacts.Dependency.DEFAULT_CONFIGURATION));
}
return moduleDescriptorState;
}
use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class DefaultResolvedDependencyTest method createResolvedArtifact.
public static DefaultResolvedArtifact createResolvedArtifact(final Mockery context, final String name, final String type, final String extension, final File file) {
final IvyArtifactName artifactStub = context.mock(IvyArtifactName.class, "artifact" + name);
context.checking(new Expectations() {
{
allowing(artifactStub).getName();
will(returnValue(name));
allowing(artifactStub).getType();
will(returnValue(type));
allowing(artifactStub).getExtension();
will(returnValue(extension));
allowing(artifactStub).getClassifier();
will(returnValue(null));
}
});
final Factory artifactSource = context.mock(Factory.class);
context.checking(new Expectations() {
{
allowing(artifactSource).create();
will(returnValue(file));
}
});
final ResolvedDependency resolvedDependency = context.mock(ResolvedDependency.class);
final ResolvedModuleVersion version = context.mock(ResolvedModuleVersion.class);
context.checking(new Expectations() {
{
allowing(resolvedDependency).getModule();
will(returnValue(version));
allowing(version).getId();
will(returnValue(new DefaultModuleVersionIdentifier("group", name, "1.2")));
}
});
return new DefaultResolvedArtifact(resolvedDependency.getModule().getId(), artifactStub, context.mock(ComponentArtifactIdentifier.class), context.mock(TaskDependency.class), artifactSource);
}
use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class PreResolvedResolvableArtifact method transformedTo.
@Override
public ResolvableArtifact transformedTo(File file) {
IvyArtifactName artifactName = DefaultIvyArtifactName.forFile(file, getClassifier());
ComponentArtifactIdentifier newId = new ComponentFileArtifactIdentifier(artifactId.getComponentIdentifier(), artifactName);
return new PreResolvedResolvableArtifact(owner, artifactName, newId, calculatedValueContainerFactory.create(Describables.of(newId), file), builtBy, calculatedValueContainerFactory);
}
use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class GradleModuleMetadataParser method consumeDependencies.
private List<ModuleDependency> consumeDependencies(JsonReader reader) throws IOException {
List<ModuleDependency> dependencies = new ArrayList<>();
reader.beginArray();
while (reader.peek() != END_ARRAY) {
String group = null;
String module = null;
String reason = null;
ImmutableAttributes attributes = ImmutableAttributes.EMPTY;
VersionConstraint version = DefaultImmutableVersionConstraint.of();
ImmutableList<ExcludeMetadata> excludes = ImmutableList.of();
List<VariantCapability> requestedCapabilities = ImmutableList.of();
IvyArtifactName artifactSelector = null;
boolean endorseStrictVersions = false;
reader.beginObject();
while (reader.peek() != END_OBJECT) {
String name = reader.nextName();
switch(name) {
case "group":
group = reader.nextString();
break;
case "module":
module = reader.nextString();
break;
case "version":
version = consumeVersion(reader);
break;
case "excludes":
excludes = consumeExcludes(reader);
break;
case "reason":
reason = reader.nextString();
break;
case "attributes":
attributes = consumeAttributes(reader);
break;
case "requestedCapabilities":
requestedCapabilities = consumeCapabilities(reader, false);
break;
case "endorseStrictVersions":
endorseStrictVersions = reader.nextBoolean();
break;
case "thirdPartyCompatibility":
reader.beginObject();
while (reader.peek() != END_OBJECT) {
String compatibilityFeatureName = reader.nextName();
if (compatibilityFeatureName.equals("artifactSelector")) {
artifactSelector = consumeArtifactSelector(reader);
} else {
consumeAny(reader);
}
}
reader.endObject();
break;
default:
consumeAny(reader);
break;
}
}
assertDefined(reader, "group", group);
assertDefined(reader, "module", module);
reader.endObject();
dependencies.add(new ModuleDependency(group, module, version, excludes, reason, attributes, requestedCapabilities, endorseStrictVersions, artifactSelector));
}
reader.endArray();
return dependencies;
}
Aggregations