use of org.gradle.api.artifacts.component.ComponentSelector in project gradle by gradle.
the class IdeaDependenciesProvider method getDependencies.
private Set<Dependency> getDependencies(IdeaModule ideaModule) {
Set<Dependency> dependencies = Sets.newLinkedHashSet();
Map<ComponentSelector, UnresolvedDependencyResult> unresolvedDependencies = Maps.newLinkedHashMap();
for (GeneratedIdeaScope scope : GeneratedIdeaScope.values()) {
IdeaDependenciesVisitor visitor = visitDependencies(ideaModule, scope);
dependencies.addAll(visitor.getDependencies());
unresolvedDependencies.putAll(visitor.getUnresolvedDependencies());
}
optimizer.optimizeDeps(dependencies);
new UnresolvedIdeDependencyHandler().log(unresolvedDependencies.values());
return dependencies;
}
use of org.gradle.api.artifacts.component.ComponentSelector in project gradle by gradle.
the class DefaultLibraryLocalComponentMetadata method projectDependencyMetadata.
// TODO: projectDependency should be transformed based on defaultProject (and other context) elsewhere.
private LocalOriginDependencyMetadata projectDependencyMetadata(ProjectDependencySpec projectDependency, String defaultProject, String usageConfigurationName) {
String projectPath = projectDependency.getProjectPath();
if (isNullOrEmpty(projectPath)) {
projectPath = defaultProject;
}
String libraryName = projectDependency.getLibraryName();
ComponentSelector selector = new DefaultLibraryComponentSelector(projectPath, libraryName);
return dependencyMetadataFor(selector, usageConfigurationName, usageConfigurationName);
}
use of org.gradle.api.artifacts.component.ComponentSelector in project gradle by gradle.
the class ProjectIvyDependencyDescriptorFactory method createDependencyDescriptor.
public DslOriginDependencyMetadata createDependencyDescriptor(String clientConfiguration, AttributeContainer clientAttributes, ModuleDependency dependency) {
ProjectDependencyInternal projectDependency = (ProjectDependencyInternal) dependency;
projectDependency.beforeResolved();
Module module = getProjectModule(dependency);
ModuleVersionSelector requested = new DefaultModuleVersionSelector(module.getGroup(), module.getName(), module.getVersion());
ComponentSelector selector = DefaultProjectComponentSelector.newSelector(projectDependency.getDependencyProject());
List<Exclude> excludes = convertExcludeRules(clientConfiguration, dependency.getExcludeRules());
LocalComponentDependencyMetadata dependencyMetaData = new LocalComponentDependencyMetadata(selector, requested, clientConfiguration, clientAttributes, projectDependency.getTargetConfiguration(), convertArtifacts(dependency.getArtifacts()), excludes, false, false, dependency.isTransitive());
return new DslOriginDependencyMetadataWrapper(dependencyMetaData, dependency);
}
use of org.gradle.api.artifacts.component.ComponentSelector in project gradle by gradle.
the class DependencyResultSerializer method read.
public DependencyResult read(Decoder decoder, Map<Long, ComponentSelector> selectors, Map<ComponentSelector, ModuleVersionResolveException> failures) throws IOException {
Long selectorId = decoder.readSmallLong();
ComponentSelector requested = selectors.get(selectorId);
byte resultByte = decoder.readByte();
if (resultByte == SUCCESSFUL) {
Long selectedId = decoder.readSmallLong();
return new DefaultDependencyResult(requested, selectedId, null, null);
} else if (resultByte == FAILED) {
ComponentSelectionReason reason = componentSelectionReasonSerializer.read(decoder);
ModuleVersionResolveException failure = failures.get(requested);
return new DefaultDependencyResult(requested, null, reason, failure);
} else {
throw new IllegalArgumentException("Unknown result type: " + resultByte);
}
}
use of org.gradle.api.artifacts.component.ComponentSelector in project gradle by gradle.
the class CompositeBuildDependencySubstitutions method execute.
@Override
public void execute(DependencySubstitution sub) {
DependencySubstitutionInternal dependencySubstitution = (DependencySubstitutionInternal) sub;
// Use the result of previous rules as the input for dependency substitution
ComponentSelector requested = dependencySubstitution.getTarget();
if (requested instanceof ModuleComponentSelector) {
ModuleComponentSelector selector = (ModuleComponentSelector) requested;
ProjectComponentIdentifier replacement = getReplacementFor(selector);
if (replacement != null) {
dependencySubstitution.useTarget(DefaultProjectComponentSelector.newSelector(replacement), VersionSelectionReasons.COMPOSITE_BUILD);
}
}
}
Aggregations