use of org.gradle.api.artifacts.MutableVersionConstraint in project gradle by gradle.
the class DefaultVersionCatalogBuilder method version.
@Override
public String version(String alias, Action<? super MutableVersionConstraint> versionSpec) {
validateAlias(AliasType.VERSION, alias);
alias = intern(normalize(alias));
if (versionConstraints.containsKey(alias)) {
// a platform, we want to silence overrides
return alias;
}
MutableVersionConstraint versionBuilder = new DefaultMutableVersionConstraint("");
versionSpec.execute(versionBuilder);
ImmutableVersionConstraint version = versionConstraintInterner.intern(DefaultImmutableVersionConstraint.of(versionBuilder));
versionConstraints.put(alias, new VersionModel(version, currentContext));
return alias;
}
use of org.gradle.api.artifacts.MutableVersionConstraint in project gradle by gradle.
the class DependenciesAwareVersionCatalogBuilder method copyDependencyVersion.
private static void copyDependencyVersion(Dependency dependency, String group, String name, MutableVersionConstraint v) {
if (dependency instanceof ExternalModuleDependency) {
VersionConstraint vc = ((ExternalModuleDependency) dependency).getVersionConstraint();
copyConstraint(vc, v);
} else {
String version = dependency.getVersion();
if (version == null || version.isEmpty()) {
throw new InvalidUserDataException("Version for dependency " + group + ":" + name + " must not be empty");
}
v.require(version);
}
}
Aggregations