From 4f9108b5c52e8f30058b4a1e7b05f33ce3aedb3e Mon Sep 17 00:00:00 2001 From: Sergei Zharinov Date: Sun, 16 Apr 2023 10:10:38 +0300 Subject: [PATCH 1/2] fix(maven): Support versions containing `+` sign --- lib/modules/versioning/maven/compare.spec.ts | 1 + lib/modules/versioning/maven/compare.ts | 4 ++-- lib/modules/versioning/maven/index.spec.ts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/modules/versioning/maven/compare.spec.ts b/lib/modules/versioning/maven/compare.spec.ts index 55b0af3d2b4587..61bcc1aaed34c2 100644 --- a/lib/modules/versioning/maven/compare.spec.ts +++ b/lib/modules/versioning/maven/compare.spec.ts @@ -187,6 +187,7 @@ describe('modules/versioning/maven/compare', () => { ${'1-0.alpha'} | ${'1-0.beta'} ${'1_5ea'} | ${'1_c3b'} ${'1_c3b'} | ${'2'} + ${'17.0.5'} | ${'17.0.5+8'} `('$x < $y', ({ x, y }) => { expect(compare(x, y)).toBe(-1); expect(compare(y, x)).toBe(1); diff --git a/lib/modules/versioning/maven/compare.ts b/lib/modules/versioning/maven/compare.ts index e65c1f2de2446f..f186d0fbfac286 100644 --- a/lib/modules/versioning/maven/compare.ts +++ b/lib/modules/versioning/maven/compare.ts @@ -44,7 +44,7 @@ function isDigit(char: string): boolean { } function isLetter(char: string): boolean { - return regEx(/^[a-z_]$/i).test(char); + return regEx(/^[a-z_+]$/i).test(char); } function isTransition(prevChar: string, nextChar: string): boolean { @@ -281,7 +281,7 @@ function isVersion(version: unknown): version is string { if (!version || typeof version !== 'string') { return false; } - if (!regEx(/^[a-z_0-9.-]+$/i).test(version)) { + if (!regEx(/^[-.a-z_+0-9]+$/i).test(version)) { return false; } if (regEx(/^[.-]/).test(version)) { diff --git a/lib/modules/versioning/maven/index.spec.ts b/lib/modules/versioning/maven/index.spec.ts index 1089a0c4aea73e..d52110c92440a3 100644 --- a/lib/modules/versioning/maven/index.spec.ts +++ b/lib/modules/versioning/maven/index.spec.ts @@ -11,6 +11,7 @@ describe('modules/versioning/maven/index', () => { test.each` version | expected ${'1.0.0'} | ${true} + ${'17.0.5+8'} | ${true} ${'[1.12.6,1.18.6]'} | ${true} ${undefined} | ${false} `('isValid("$version") === $expected', ({ version, expected }) => { From fbf0572eb5f01bfb447bb9a6ef22bac30f5b6e6d Mon Sep 17 00:00:00 2001 From: Sergei Zharinov Date: Sun, 16 Apr 2023 11:26:19 +0300 Subject: [PATCH 2/2] Fix Ivy --- lib/modules/versioning/ivy/index.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/modules/versioning/ivy/index.ts b/lib/modules/versioning/ivy/index.ts index d8999f85ced7fc..79ff4641c11f70 100644 --- a/lib/modules/versioning/ivy/index.ts +++ b/lib/modules/versioning/ivy/index.ts @@ -42,13 +42,27 @@ function isValid(str: string): boolean { if (!str) { return false; } - return maven.isVersion(str) || !!parseDynamicRevision(str); + + if (LATEST_REGEX.test(str)) { + return true; + } + + return isVersion(str) || !!parseDynamicRevision(str); } function isVersion(str: string): boolean { - if (!str || LATEST_REGEX.test(str)) { + if (!str) { return false; } + + if (LATEST_REGEX.test(str)) { + return false; + } + + if (str.includes('+')) { + return false; + } + return maven.isVersion(str); }