-
Notifications
You must be signed in to change notification settings - Fork 5k
Deprecate using legacy Usage attribute values #35238
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
base: master
Are you sure you want to change the base?
Deprecate using legacy Usage attribute values #35238
Conversation
ad5e8b4
to
70c0d41
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
70c0d41
to
d219dac
Compare
The following builds have failed: |
These legacy attribute values were deprecated in Gradle 5.6, with the intention to add deprecation warnings in 6.0 Better late than never, so we're adding the deprecations now. Trying to use any of these legacy Usage values in build logic will result in a deprecation warning, as the mutable attribute container emits a warning if it encounters a legacy value. Additionally, we specially handle legacy Usage attributes in published GMM parsing, as published GMM with these attributes must always be handled in a backwards compatible manner. In all other cases, traces of these legacy attributes have been removed from the core attribute container implementation. Attribute containers should be agnostic about the attributes they hold, and should not treat certain attributes specially compared to others
d219dac
to
2230307
Compare
@bot-gradle test this |
This comment has been minimized.
This comment has been minimized.
The following builds have failed: |
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.
NIT on upgrade guide.
Use link:{javadocPath}/org/gradle/api/tasks/wrapper/Wrapper.DistributionType.html#values()[`Wrapper.DistributionType.values()`] to obtain the available distribution types instead. | ||
|
||
[[deprecate_legacy_usage_values]] | ||
==== Deprecated legacy Usage attribute values |
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.
==== Deprecated legacy Usage attribute values | |
==== Deprecated legacy `Usage` attribute values |
[[deprecate_legacy_usage_values]] | ||
==== Deprecated legacy Usage attribute values | ||
|
||
Since Gradle 5.6, the link:{javadocPath}/org/gradle/api/attributes/Usage.html[`Usage`] attribute was split into a separate link:{javadocPath}/org/gradle/api/attributes/LibraryElements.html[`LibraryElements`] attribute. |
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.
Since Gradle 5.6, the link:{javadocPath}/org/gradle/api/attributes/Usage.html[`Usage`] attribute was split into a separate link:{javadocPath}/org/gradle/api/attributes/LibraryElements.html[`LibraryElements`] attribute. | |
Since Gradle 5.6, the link:{javadocPath}/org/gradle/api/attributes/Usage.html[`Usage`] attribute has been split into a separate link:{javadocPath}/org/gradle/api/attributes/LibraryElements.html[`LibraryElements`] attribute. |
==== Deprecated legacy Usage attribute values | ||
|
||
Since Gradle 5.6, the link:{javadocPath}/org/gradle/api/attributes/Usage.html[`Usage`] attribute was split into a separate link:{javadocPath}/org/gradle/api/attributes/LibraryElements.html[`LibraryElements`] attribute. | ||
In the JVM ecosystem, `Usage` controls whether a variant is intended for compilation or runtime, while `LibraryElements` controls the format of the artifact (for example, JAR or classes directory). |
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.
In the JVM ecosystem, `Usage` controls whether a variant is intended for compilation or runtime, while `LibraryElements` controls the format of the artifact (for example, JAR or classes directory). | |
In the JVM ecosystem, `Usage` indicates whether a variant is intended for compilation or runtime, while `LibraryElements` specifies the format of the artifact (for example, a JAR file or a classes directory). |
Since Gradle 5.6, the link:{javadocPath}/org/gradle/api/attributes/Usage.html[`Usage`] attribute was split into a separate link:{javadocPath}/org/gradle/api/attributes/LibraryElements.html[`LibraryElements`] attribute. | ||
In the JVM ecosystem, `Usage` controls whether a variant is intended for compilation or runtime, while `LibraryElements` controls the format of the artifact (for example, JAR or classes directory). | ||
|
||
In order to ease the migration, Gradle automatically maps legacy `Usage` values to the corresponding `Usage` and `LibraryElements` values: |
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.
In order to ease the migration, Gradle automatically maps legacy `Usage` values to the corresponding `Usage` and `LibraryElements` values: | |
To ease migration, Gradle has automatically mapped legacy `Usage` values to their corresponding `Usage` and `LibraryElements` pairs: |
In the JVM ecosystem, `Usage` controls whether a variant is intended for compilation or runtime, while `LibraryElements` controls the format of the artifact (for example, JAR or classes directory). | ||
|
||
In order to ease the migration, Gradle automatically maps legacy `Usage` values to the corresponding `Usage` and `LibraryElements` values: | ||
|=== |
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.
|=== | |
|=== |
| `java-runtime-resources` | `java-runtime` | `resources` | ||
|=== | ||
|
||
Starting in Gradle 10, Gradle will no longer perform this automatic mapping when a legacy `Usage` value is added to an `AttributeContainer` in build logic. |
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.
Starting in Gradle 10, Gradle will no longer perform this automatic mapping when a legacy `Usage` value is added to an `AttributeContainer` in build logic. | |
Starting with Gradle 10, this automatic mapping will no longer occur when legacy `Usage` values are added directly to an `AttributeContainer` in build logic. |
|=== | ||
|
||
Starting in Gradle 10, Gradle will no longer perform this automatic mapping when a legacy `Usage` value is added to an `AttributeContainer` in build logic. | ||
In order to maintain backward compatibility with published metadata, Gradle will continue to translate legacy `Usage` values found in published Gradle Module Metadata. |
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.
In order to maintain backward compatibility with published metadata, Gradle will continue to translate legacy `Usage` values found in published Gradle Module Metadata. | |
To maintain backward compatibility, Gradle will continue translating legacy `Usage` values found in published Gradle Module Metadata. |
These legacy attribute values were deprecated in Gradle 5.6, with the intention to add deprecation warnings in 6.0 Better late than never, so we're adding the deprecations now.
Trying to use any of these legacy Usage values in build logic will result in a deprecation warning, as the mutable attribute container emits a warning if it encounters a legacy value.
Additionally, we specially handle legacy Usage attributes in published GMM parsing, as published GMM with these attributes must always be handled in a backwards compatible manner.
In all other cases, traces of these legacy attributes have been removed from the core attribute container implementation. Attribute containers should be agnostic about the attributes they hold, and should not treat certain attributes specially compared to others
Reviewing cheatsheet
Before merging the PR, comments starting with