use of org.gradle.api.artifacts.ModuleDependency in project gradle by gradle.
the class ResolvedConfigurationDependencyGraphVisitor method visitEdges.
public void visitEdges(DependencyGraphNode resolvedConfiguration) {
for (DependencyGraphEdge dependency : resolvedConfiguration.getIncomingEdges()) {
if (dependency.getFrom() == root) {
ModuleDependency moduleDependency = dependency.getModuleDependency();
builder.addFirstLevelDependency(moduleDependency, resolvedConfiguration);
}
}
}
use of org.gradle.api.artifacts.ModuleDependency in project gradle by gradle.
the class ClientModuleResolver method addClientModuleDependencies.
private void addClientModuleDependencies(ClientModule clientModule, MutableModuleComponentResolveMetadata clientModuleMetaData) {
List<DependencyMetadata> dependencies = Lists.newArrayList();
for (ModuleDependency moduleDependency : clientModule.getDependencies()) {
DependencyMetadata dependencyMetadata = dependencyDescriptorFactory.createDependencyDescriptor(moduleDependency.getTargetConfiguration(), null, moduleDependency);
dependencies.add(dependencyMetadata);
}
clientModuleMetaData.setDependencies(dependencies);
}
use of org.gradle.api.artifacts.ModuleDependency in project gradle by gradle.
the class ModuleFactoryDelegateTest method module.
@Test
public void module() {
final String clientModuleNotation = "someNotation";
final Closure configureClosure = TestUtil.toClosure("{}");
final ClientModule clientModuleDummy = context.mock(ClientModule.class);
context.checking(new Expectations() {
{
allowing(dependencyFactoryStub).createModule(clientModuleNotation, configureClosure);
will(returnValue(clientModuleDummy));
}
});
moduleFactoryDelegate.module(clientModuleNotation, configureClosure);
assertThat(this.clientModule.getDependencies(), Matchers.equalTo(WrapUtil.<ModuleDependency>toSet(clientModuleDummy)));
}
use of org.gradle.api.artifacts.ModuleDependency in project gradle by gradle.
the class ExternalModuleDependencyDescriptorFactoryTest method testAddWithNullGroupAndNullVersionShouldHaveEmptyStringModuleRevisionValues.
@Test
public void testAddWithNullGroupAndNullVersionShouldHaveEmptyStringModuleRevisionValues() {
ModuleDependency dependency = new DefaultExternalModuleDependency(null, "gradle-core", null, TEST_DEP_CONF);
LocalOriginDependencyMetadata dependencyMetaData = externalModuleDependencyDescriptorFactory.createDependencyDescriptor(componentId, TEST_CONF, null, dependency);
ModuleComponentSelector selector = (ModuleComponentSelector) dependencyMetaData.getSelector();
assertThat(selector.getGroup(), equalTo(""));
assertThat(selector.getModule(), equalTo("gradle-core"));
assertThat(selector.getVersion(), equalTo(""));
assertThat(selector.getVersionConstraint().getPreferredVersion(), equalTo(""));
}
use of org.gradle.api.artifacts.ModuleDependency in project gradle by gradle.
the class DefaultLocalConfigurationMetadataBuilder method addDependencies.
private void addDependencies(BuildableLocalConfigurationMetadata configurationMetadata, ConfigurationInternal configuration) {
AttributeContainerInternal attributes = configuration.getAttributes();
for (Dependency dependency : configuration.getDependencies()) {
if (dependency instanceof ModuleDependency) {
ModuleDependency moduleDependency = (ModuleDependency) dependency;
configurationMetadata.addDependency(dependencyDescriptorFactory.createDependencyDescriptor(configurationMetadata.getComponentId(), configuration.getName(), attributes, moduleDependency));
} else if (dependency instanceof FileCollectionDependency) {
final FileCollectionDependency fileDependency = (FileCollectionDependency) dependency;
configurationMetadata.addFiles(new DefaultLocalFileDependencyMetadata(fileDependency));
} else {
throw new IllegalArgumentException("Cannot convert dependency " + dependency + " to local component dependency metadata.");
}
}
}
Aggregations