use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class DefaultConflictHandler method maybeSetReason.
private void maybeSetReason(Set<ModuleIdentifier> partifipants, ComponentResolutionState selected) {
for (ModuleIdentifier identifier : partifipants) {
ModuleReplacementsData.Replacement replacement = moduleReplacements.getReplacementFor(identifier);
if (replacement != null) {
String reason = replacement.getReason();
ComponentSelectionDescriptorInternal moduleReplacement = ComponentSelectionReasons.SELECTED_BY_RULE.withDescription(Describables.of(identifier, "replaced with", replacement.getTarget()));
if (reason != null) {
moduleReplacement = moduleReplacement.withDescription(Describables.of(reason));
}
selected.addCause(moduleReplacement);
}
}
}
use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class DefaultConflictHandler method registerCandidate.
/**
* Registers new newModule and returns an instance of a conflict if conflict exists.
*/
@Override
@Nullable
public PotentialConflict registerCandidate(CandidateModule candidate) {
ModuleReplacementsData.Replacement replacement = moduleReplacements.getReplacementFor(candidate.getId());
ModuleIdentifier replacedBy = replacement == null ? null : replacement.getTarget();
return potentialConflict(conflicts.newElement(candidate.getId(), candidate.getVersions(), replacedBy));
}
use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class ExternalResourceResolver method doListModuleVersions.
private void doListModuleVersions(ModuleDependencyMetadata dependency, BuildableModuleVersionListingResolveResult result) {
ModuleIdentifier module = dependency.getSelector().getModuleIdentifier();
tryListingViaRule(module, result);
if (result.hasResult() && result.isAuthoritative()) {
return;
}
// TODO: Provide an abstraction for accessing resources within the same module (maven-metadata, directory listing, etc)
// That way we can avoid passing `ivyPatterns` and `artifactPatterns` around everywhere
ResourceVersionLister versionLister = new ResourceVersionLister(repository);
List<ResourcePattern> completeIvyPatterns = filterComplete(this.ivyPatterns, module);
List<ResourcePattern> completeArtifactPatterns = filterComplete(this.artifactPatterns, module);
// Iterate over the metadata sources to see if they can provide the version list
for (MetadataSource<?> metadataSource : metadataSources.sources()) {
metadataSource.listModuleVersions(dependency, module, completeIvyPatterns, completeArtifactPatterns, versionLister, result);
if (result.hasResult() && result.isAuthoritative()) {
return;
}
}
result.listed(ImmutableSet.of());
}
use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class JsonProjectDependencyRenderer method populateModulesWithChildDependencies.
private void populateModulesWithChildDependencies(RenderableDependency dependency, Set<ComponentIdentifier> visited, Set<ModuleIdentifier> modules) {
for (RenderableDependency childDependency : dependency.getChildren()) {
ModuleIdentifier moduleId = getModuleIdentifier(childDependency);
if (moduleId == null) {
continue;
}
modules.add(moduleId);
boolean alreadyVisited = !visited.add((ComponentIdentifier) childDependency.getId());
if (!alreadyVisited) {
populateModulesWithChildDependencies(childDependency, visited, modules);
}
}
}
use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class ComponentModuleMetadataContainer method module.
public ComponentModuleMetadataDetails module(final Object sourceModule) {
final NotationParser<Object, ModuleIdentifier> parser = parser(moduleIdentifierFactory);
final ModuleIdentifier source = parser.parseNotation(sourceModule);
return new ComponentModuleMetadataDetails() {
@Override
public void replacedBy(Object moduleNotation) {
replacedBy(moduleNotation, null);
}
@Override
public void replacedBy(final Object targetModule, @Nullable String reason) {
ModuleIdentifier target = parser.parseNotation(targetModule);
detectCycles(replacements, source, target);
replacements.put(source, new Replacement(target, reason));
targets.add(target);
}
@Override
public ModuleIdentifier getId() {
return source;
}
@Override
public ModuleIdentifier getReplacedBy() {
return unwrap(replacements.get(source));
}
};
}
Aggregations