Skip to content
Snippets Groups Projects
Unverified Commit e3e6de9f authored by cjtim's avatar cjtim Committed by GitHub
Browse files

fix(managers/gradle): allow dot annotation in version.ref (#21820)

parent 3f68122e
No related branches found
No related tags found
No related merge requests found
......@@ -17,5 +17,5 @@ kotest = [ "kotest-runner-junit5", "kotest-assertions-core-jvm" ]
[plugins]
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
publish-on-central = { id = "org.danilopianini.publish-on-central", version.ref = "publish-on-central" }
publish-on-central = { id = "org.danilopianini.publish-on-central", version.ref = "publish.on.central" }
grgit = { id = "org.ajoberstar.grgit", version.unknown = "this will fail" }
......@@ -7,4 +7,4 @@ junit = "1.4.9"
[libraries]
junit-legacy = { module = "junit:junit", version.ref = "junit" }
mocha-junit = { module = "mocha-junit:mocha-junit", version.ref = "mocha-junit-reporter" }
mocha-junit = { module = "mocha-junit:mocha-junit", version.ref = "mocha.junit.reporter" }
......@@ -55,6 +55,10 @@ function isVersionPointer(
return hasKey('ref', obj);
}
function normalizeVersionPointer(versionPointer: string): string {
return versionPointer.replace(regEx(/[._]/g), '-');
}
interface VersionExtract {
currentValue?: string;
fileReplacePosition?: number;
......@@ -79,12 +83,13 @@ function extractVersion({
versionSubContent: string;
}): VersionExtract {
if (isVersionPointer(version)) {
const parsedVersion = normalizeVersionPointer(version.ref);
// everything else is ignored
return extractLiteralVersion({
version: versions[version.ref],
version: versions[parsedVersion],
depStartIndex: versionStartIndex,
depSubContent: versionSubContent,
sectionKey: version.ref,
sectionKey: parsedVersion,
});
} else {
return extractLiteralVersion({
......@@ -205,7 +210,7 @@ function extractDependency({
};
}
const versionRef = isVersionPointer(descriptor.version)
? descriptor.version.ref
? normalizeVersionPointer(descriptor.version.ref)
: null;
if (isArtifactDescriptor(descriptor)) {
const { group, name } = descriptor;
......@@ -284,7 +289,7 @@ export function parseCatalog(
dependency.skipReason = skipReason;
}
if (isVersionPointer(version) && dependency.commitMessageTopic) {
dependency.groupName = version.ref;
dependency.groupName = normalizeVersionPointer(version.ref);
delete dependency.commitMessageTopic;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment