Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bug edge case in gradle versioning for versions that end with a separator #33604

Open
PhilipAbed opened this issue Jan 14, 2025 Discussed in #33581 · 0 comments
Open

A bug edge case in gradle versioning for versions that end with a separator #33604

PhilipAbed opened this issue Jan 14, 2025 Discussed in #33581 · 0 comments
Labels
priority-4-low Low priority, unlikely to be done unless it becomes important to more people type:bug Bug fix of existing functionality versioning:gradle Gradle versioning

Comments

@PhilipAbed
Copy link
Collaborator

Discussed in #33581

Originally posted by PhilipAbed January 12, 2025

How are you running Renovate?

Self-hosted Renovate

If you're self-hosting Renovate, tell us which platform (GitHub, GitLab, etc) and which version of Renovate.

github

Please tell us more about your question or problem

The failed version is taken from here: https://mvnrepository.com/artifact/org.jenkins-ci.plugins/token-macro

input is: 400.v35420b_922dcb_

and it fails to tokenize this version in gradle.

to reproduce the bug
add a test to the lib/modules/versioning/gradle/index.spec.ts

it.each`
    input                        | expected
    ${'400.v35420b_922dcb'}     | ${true}
    ${'400.v35420b_922dcb_'}      | ${true}
  `('isVersion("$input") === $expected', ({ input, expected }) => {
    expect(api.isVersion(input)).toBe(expected);
  });

The first succeeds but the second fails because it ends with a _ separator

so i tried the same test in lib/modules/versioning/maven/index.spec.ts
and it works like a charm.

here's the results of Gradle versioning tokenize:
image
note: returns null when it reaches the last character _

here's the result of Maven versioning tokenize
image

I noticed both functions in gradle and maven have the same purpose but.

each of them consider different separators.

Gradle has "_" as a separator while maven considers it a normal letter.

They mention in gradle docs Versions are divided into parts using the characters [. - _ +].
yet they let you set a version that ends with a separator which is confusing our resolution

We should not deviate from the gradle docs.
but there's no harm in changing tokenize function to allow ending with a separator "_"

@PhilipAbed PhilipAbed changed the title A bug in gradle versioning for versions that end with a separator A bug edge case in gradle versioning for versions that end with a separator Jan 14, 2025
@rarkins rarkins added type:bug Bug fix of existing functionality versioning:gradle Gradle versioning priority-4-low Low priority, unlikely to be done unless it becomes important to more people labels Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-4-low Low priority, unlikely to be done unless it becomes important to more people type:bug Bug fix of existing functionality versioning:gradle Gradle versioning
Projects
None yet
Development

No branches or pull requests

2 participants