Skip to content

Commit 4dece8e

Browse files
committed
[build] Use non-capturing groups for all numeric segments in qualifyVersion
Signed-off-by: Violeta Georgieva <[email protected]>
1 parent 1721428 commit 4dece8e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎build.gradle‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ static def qualifyVersion(String v) {
8787
return "BAD"
8888
}
8989
//new scheme: major.minor.patch[.hotfix][-qualifier]
90-
//the hotfix segment uses a non-capturing group (?:...) so the qualifier stays at group(4)
91-
def match = v =~ /^(\d+)\.(\d+)\.(\d+)(?:\.\d+)?(?:-(.+))?$/
90+
//all numeric segments use (?:...) non-capturing groups since only the qualifier is needed; it lands at group(1)
91+
def match = v =~ /^(?:\d+)\.(?:\d+)\.(?:\d+)(?:\.\d+)?(?:-(.+))?$/
9292
if (!match.matches()) return "BAD"
9393

94-
def qualifier = match.group(4)
94+
def qualifier = match.group(1)
9595
if (qualifier == null || qualifier.isEmpty()) return "RELEASE"
9696
if (qualifier.matches("(?:M|RC)\\d+")) return "MILESTONE"
9797
if (qualifier == "SNAPSHOT") return "SNAPSHOT"

0 commit comments

Comments
 (0)