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

Replacement for VersionNumber #17450

Closed
simonschiller opened this issue Jun 15, 2021 · 2 comments
Closed

Replacement for VersionNumber #17450

simonschiller opened this issue Jun 15, 2021 · 2 comments
Labels
a:feature A new functionality

Comments

@simonschiller
Copy link

Looks like org.gradle.util.VersionNumber was deprecated and moved to an internal class in 7.1. Is there any replacement which plugin authors can use that will survive the switch to 8.0?

This class always came in super handy when working with various version numbers, so I'd be sad to see it go without any replacement.

@simonschiller simonschiller added a:feature A new functionality to-triage labels Jun 15, 2021
@big-guy
Copy link
Member

big-guy commented Jun 15, 2021

There are no plans to provide a replacement API right now.

Your best option is to either 1) copy the class into the plugin or 2) find an external library that does something similar.

The problem with VersionNumber is that there is no single standard way to format a version. This class takes an approach that's like many version formats, but it was always limited to what was useful for our specific needs and wasn't general purpose.

It's very tempting to pass a String into this and get something out that's a "version", but there are no guarantees that it makes any sense unless you know how the version format should be interpreted. The thinking is that it's best to leave version parsing/interpretation up to the plugin that has the context about the version.

@elwaxoro
Copy link

Is there a recommended workaround for this? Was planning to use VersionNumber to force a minimum version of log4j due to CVE-2021-44228 without having to bring in additional plugins just to parse a version string:

        resolutionStrategy.eachDependency {
            if (requested.group == "org.apache.logging.log4j" && VersionNumber.parse(requested.version) < VersionNumber.parse("2.15.0")) {
                useVersion("2.15.0")
                because("CVE-2021-44228")
            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:feature A new functionality
Projects
None yet
Development

No branches or pull requests

3 participants