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
Support constraint without version in GMM #20188
Support constraint without version in GMM #20188
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one minor change I had a question about but it's not blocking.
...a/org/gradle/api/internal/artifacts/dsl/dependencies/DefaultDependencyConstraintHandler.java
Outdated
Show resolved
Hide resolved
@@ -439,7 +439,7 @@ private IvyArtifactName consumeArtifactSelector(JsonReader reader) throws IOExce | |||
String group = null; | |||
String module = null; | |||
String reason = null; | |||
VersionConstraint version = null; | |||
VersionConstraint version = DefaultImmutableVersionConstraint.of(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❔ - As far as I understand the issue, the fix boils down to this line here.
According to the issue, it was expected that a constraint always have a version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, but the assumption made here was wrong. The Gradle DSL allows to define a constraint without version. The whole dependency graph engine works fine with a constraint that has an empty version. And there are limited use cases for this - see the added test.
What is clearly not supported by the engine is a null
version, this is fixed by this change.
Prior to this change, a published Gradle Module Metadata that contained a constraint without a version definition would result in a null VersionConstraint instead of an empty one. This caused issue during metadata serialization and potentially resolution. The field is not nullable and an empty version constraint is now used as the default value. Fixes #20182
8a20db0
to
bec7996
Compare
OK, I've already triggered a build for you. |
So the ~10% performance regression seems to be true... |
Pre-tested commit build failed. |
@bot-gradle test and merge |
OK, I've already triggered a build for you. |
No description provided.