use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class ModuleExclusions method forExclude.
private ExcludeSpec forExclude(ExcludeMetadata r) {
return metadataToExcludeCache.computeIfAbsent(r, rule -> {
// For custom ivy pattern matchers, don't inspect the rule any more deeply: this prevents us from doing smart merging later
if (!PatternMatchers.isExactMatcher(rule.getMatcher())) {
return factory.ivyPatternExclude(rule.getModuleId(), rule.getArtifact(), rule.getMatcher());
}
ModuleIdentifier moduleId = rule.getModuleId();
IvyArtifactName artifact = rule.getArtifact();
boolean anyOrganisation = isWildcard(moduleId.getGroup());
boolean anyModule = isWildcard(moduleId.getName());
// Build a strongly typed (mergeable) exclude spec for each supplied rule
if (artifact == null) {
if (!anyOrganisation && !anyModule) {
return factory.moduleId(moduleId);
} else if (!anyModule) {
return factory.module(moduleId.getName());
} else if (!anyOrganisation) {
return factory.group(moduleId.getGroup());
} else {
return factory.everything();
}
} else {
return factory.ivyPatternExclude(moduleId, artifact, rule.getMatcher());
}
});
}
use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class DefaultPendingDependenciesVisitor method maybeAddAsPendingDependency.
@Override
public PendingState maybeAddAsPendingDependency(NodeState node, DependencyState dependencyState) {
ModuleIdentifier key = dependencyState.getModuleIdentifier();
boolean isConstraint = dependencyState.getDependency().isConstraint();
if (!isConstraint) {
if (markNotPending(key)) {
return PendingState.NOT_PENDING_ACTIVATING;
} else {
return PendingState.NOT_PENDING;
}
}
// Adding an optional dependency: see if we already have a hard dependency on the same module
ModuleResolveState module = resolveState.getModule(key);
boolean pending = module.isPending();
// Already have a hard dependency, this optional dependency is not pending.
if (!pending) {
return PendingState.NOT_PENDING;
}
// No hard dependency, queue up pending dependency in case we see a hard dependency later.
module.registerConstraintProvider(node);
return PendingState.PENDING;
}
use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class DefaultImmutableModuleIdentifierFactory method moduleWithVersion.
@Override
public ModuleVersionIdentifier moduleWithVersion(String group, String name, String version) {
ModuleIdentifier mi = module(group, name);
Map<String, ModuleVersionIdentifier> byVersion = idToVersions.get(mi);
if (byVersion == null) {
byVersion = idToVersions.get(mi);
if (byVersion == null) {
byVersion = Maps.newConcurrentMap();
idToVersions.put(mi, byVersion);
}
}
ModuleVersionIdentifier identifier = byVersion.get(version);
if (identifier == null) {
identifier = new DefaultModuleVersionIdentifier(mi, version);
byVersion.put(version, identifier);
}
return identifier;
}
use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class DefaultAutoAppliedPluginRegistry method createGradleEnterprisePluginRequest.
private static PluginRequestInternal createGradleEnterprisePluginRequest() {
ModuleIdentifier moduleIdentifier = DefaultModuleIdentifier.newId(AutoAppliedGradleEnterprisePlugin.GROUP, AutoAppliedGradleEnterprisePlugin.NAME);
ModuleVersionSelector artifact = DefaultModuleVersionSelector.newSelector(moduleIdentifier, AutoAppliedGradleEnterprisePlugin.VERSION);
return new DefaultPluginRequest(AutoAppliedGradleEnterprisePlugin.ID, AutoAppliedGradleEnterprisePlugin.VERSION, true, null, getScriptDisplayName(), artifact);
}
use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class DependenciesAwareVersionCatalogBuilder method collectConstraints.
private void collectConstraints(DependencyConstraintSet allConstraints, Set<ModuleIdentifier> seen) {
for (DependencyConstraint constraint : allConstraints) {
String group = constraint.getGroup();
String name = constraint.getName();
ModuleIdentifier id = DefaultModuleIdentifier.newId(group, name);
if (seen.add(id)) {
String alias = explicitAliases.get(id);
if (alias != null) {
library(alias, group, name).version(into -> copyConstraint(constraint.getVersionConstraint(), into));
} else {
tryGenericAlias(group, name, into -> copyConstraint(constraint.getVersionConstraint(), into));
}
} else {
LOGGER.warn("Duplicate entry for constraint " + group + ":" + name);
}
}
}
Aggregations