Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Renovate Bot
renovate
Commits
563cdabc
Unverified
Commit
563cdabc
authored
2 months ago
by
Sergei Zharinov
Committed by
GitHub
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(gradle): Accept versions with trailing separators as valid (#33884)
parent
6be155da
No related branches found
Branches containing commit
Tags
39.137.1
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/modules/versioning/gradle/compare.ts
+10
-8
10 additions, 8 deletions
lib/modules/versioning/gradle/compare.ts
lib/modules/versioning/gradle/index.spec.ts
+10
-0
10 additions, 0 deletions
lib/modules/versioning/gradle/index.spec.ts
with
20 additions
and
8 deletions
lib/modules/versioning/gradle/compare.ts
+
10
−
8
View file @
563cdabc
...
...
@@ -49,10 +49,6 @@ export function tokenize(versionStr: string): Token[] | null {
let
currentVal
=
''
;
function
yieldToken
():
void
{
if
(
currentVal
===
''
)
{
// We tried to yield an empty token, which means we're in a bad state.
result
=
null
;
}
if
(
result
)
{
const
val
=
currentVal
;
if
(
regEx
(
/^
\d
+$/
).
test
(
val
))
{
...
...
@@ -73,8 +69,12 @@ export function tokenize(versionStr: string): Token[] | null {
if
(
nextChar
===
null
)
{
yieldToken
();
}
else
if
(
isSeparator
(
nextChar
))
{
yieldToken
();
currentVal
=
''
;
if
(
prevChar
&&
!
isSeparator
(
prevChar
))
{
yieldToken
();
currentVal
=
''
;
}
else
{
result
=
null
;
}
}
else
if
(
prevChar
!==
null
&&
isTransition
(
prevChar
,
nextChar
))
{
yieldToken
();
currentVal
=
nextChar
;
...
...
@@ -243,11 +243,13 @@ export function parsePrefixRange(input: string): PrefixRange | null {
return
{
tokens
:
[]
};
}
const
postfixRegex
=
regEx
(
/
[
-._
]\+
$/
);
const
postfixRegex
=
regEx
(
/
[
^
-._+
][
-._
]\+
$/
);
if
(
postfixRegex
.
test
(
input
))
{
const
prefixValue
=
input
.
replace
(
regEx
(
/
[
-._
]\+
$/
),
''
);
const
tokens
=
tokenize
(
prefixValue
);
return
tokens
?
{
tokens
}
:
null
;
if
(
tokens
)
{
return
{
tokens
};
}
}
return
null
;
...
...
This diff is collapsed.
Click to expand it.
lib/modules/versioning/gradle/index.spec.ts
+
10
−
0
View file @
563cdabc
...
...
@@ -78,6 +78,8 @@ describe('modules/versioning/gradle/index', () => {
${
'
1.0-sp-1
'
}
|
${
'
1.0-release
'
}
|
${
1
}
${
'
1.0-sp-2
'
}
|
${
'
1.0-sp-1
'
}
|
${
1
}
${
''
}
|
${
''
}
|
${
0
}
${
'
384.vf35b_f26814ec
'
}
|
${
'
400.v35420b_922dcb_
'
}
|
${
-
1
}
${
'
___
'
}
|
${
'
...
'
}
|
${
0
}
`
(
'
compare("$a", "$b") === $expected
'
,
({
a
,
b
,
expected
})
=>
{
expect
(
compare
(
a
,
b
)).
toEqual
(
expected
);
});
...
...
@@ -158,6 +160,14 @@ describe('modules/versioning/gradle/index', () => {
${
'
1++2
'
}
|
${
false
}
${
'
1--2
'
}
|
${
false
}
${
'
1__2
'
}
|
${
false
}
${
'
400.v35420b_922dcb_
'
}
|
${
true
}
${
'
400.v35420b_922dcb
'
}
|
${
true
}
${
'
__
'
}
|
${
false
}
${
'
_.
'
}
|
${
false
}
${
'
._
'
}
|
${
false
}
${
'
_+
'
}
|
${
false
}
${
'
+.
'
}
|
${
false
}
${
'
.+
'
}
|
${
false
}
`
(
'
isVersion("$input") === $expected
'
,
({
input
,
expected
})
=>
{
expect
(
api
.
isVersion
(
input
)).
toBe
(
expected
);
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment