use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class DefaultComponentMetadataHandler method createSpecRuleActionForModule.
private SpecRuleAction<? super ComponentMetadataDetails> createSpecRuleActionForModule(Object id, RuleAction<? super ComponentMetadataDetails> ruleAction) {
ModuleIdentifier moduleIdentifier;
try {
moduleIdentifier = moduleIdentifierNotationParser.parseNotation(id);
} catch (UnsupportedNotationException e) {
throw new InvalidUserCodeException(String.format(INVALID_SPEC_ERROR, id == null ? "null" : id.toString()), e);
}
Spec<ComponentMetadataDetails> spec = new ComponentMetadataDetailsMatchingSpec(moduleIdentifier);
return new SpecRuleAction<>(ruleAction, spec);
}
use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class DefaultComponentMetadataHandler method createModuleSpecConfigurableRule.
private SpecConfigurableRule createModuleSpecConfigurableRule(Object id, ConfigurableRule<ComponentMetadataContext> instantiatingAction) {
ModuleIdentifier moduleIdentifier;
try {
moduleIdentifier = moduleIdentifierNotationParser.parseNotation(id);
} catch (UnsupportedNotationException e) {
throw new InvalidUserCodeException(String.format(INVALID_SPEC_ERROR, id == null ? "null" : id.toString()), e);
}
Spec<ModuleVersionIdentifier> spec = new ModuleVersionIdentifierSpec(moduleIdentifier);
return new SpecConfigurableRule(instantiatingAction, spec);
}
use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class CompositeBuildDependencySubstitutions method getReplacementFor.
private ProjectComponentIdentifier getReplacementFor(ModuleComponentSelector selector) {
ModuleIdentifier candidateId = selector.getModuleIdentifier();
Collection<ProjectComponentIdentifier> providingProjects = replacementMap.get(candidateId);
if (providingProjects.isEmpty()) {
LOGGER.debug("Found no composite build substitute for module '{}'.", candidateId);
return null;
}
if (providingProjects.size() == 1) {
ProjectComponentIdentifier match = providingProjects.iterator().next();
LOGGER.info("Found project '{}' as substitute for module '{}'.", match, candidateId);
return match;
}
throw new ModuleVersionResolveException(selector, () -> {
SortedSet<String> sortedProjects = providingProjects.stream().map(ComponentIdentifier::getDisplayName).collect(Collectors.toCollection(TreeSet::new));
return String.format("Module version '%s' is not unique in composite: can be provided by %s.", selector.getDisplayName(), sortedProjects);
});
}
use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class DefaultImmutableModuleIdentifierFactory method module.
@Override
public ModuleIdentifier module(String group, String name) {
Map<String, ModuleIdentifier> byName = groupIdToModules.get(group);
if (byName == null) {
byName = groupIdToModules.computeIfAbsent(group, k -> Maps.newConcurrentMap());
}
ModuleIdentifier moduleIdentifier = byName.get(name);
if (moduleIdentifier == null) {
moduleIdentifier = DefaultModuleIdentifier.newId(group, name);
byName.put(name, moduleIdentifier);
}
return moduleIdentifier;
}
use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class DefaultImmutableModuleIdentifierFactory method moduleWithVersion.
@Override
public ModuleVersionIdentifier moduleWithVersion(ModuleIdentifier mi, String version) {
Map<String, ModuleVersionIdentifier> byVersion = idToVersions.get(mi);
if (byVersion == null) {
byVersion = idToVersions.computeIfAbsent(mi, k -> Maps.newConcurrentMap());
}
ModuleVersionIdentifier identifier = byVersion.get(version);
if (identifier == null) {
identifier = DefaultModuleVersionIdentifier.newId(mi, version);
byVersion.put(version, identifier);
}
return identifier;
}
Aggregations