-
Notifications
You must be signed in to change notification settings - Fork 110
Fix deprecated Gradle syntax and configuration features #3358
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
Merged
arnaud-lacurie
merged 5 commits into
FoundationDB:main
from
jen20:jen20/fix-gradle-deprecations
May 25, 2025
Merged
Fix deprecated Gradle syntax and configuration features #3358
arnaud-lacurie
merged 5 commits into
FoundationDB:main
from
jen20:jen20/fix-gradle-deprecations
May 25, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This fixes two Gradle deprecation warnings related to the output location of JUnit XML reports, as documented in [1]. [1]: https://docs.gradle.org/8.13/dsl/org.gradle.api.reporting.Report.html#org.gradle.api.reporting.Report:destination
This fixes usages of variable assignment via both space assigment and propertyName(value) per the deprecation warnings for Gradle 8, as documented in [1]. Instead, we adopt the recommended property = value syntax. [1]: https://docs.gradle.org/8.13/userguide/upgrading_version_8.html#groovy_space_assignment_syntax
This wraps deprcated usages of Java plugin conventions to use a plugin block, as documented in [1]. [1]: https://docs.gradle.org/8.13/userguide/upgrading_version_8.html#java_convention_deprecation
This commit fixes the deprecated usages of Gradle Application plugin conventions, by wrapping usage in plugin blocks as described in [1]. It also replaces usage of mainClassName with mainClass, a change necessitated by the Gradle 7 -> 8 migrations [2], but still supported via plugin conventions. [1]: https://docs.gradle.org/8.13/userguide/upgrading_version_8.html#application_convention_deprecation [2]: https://docs.gradle.org/current/userguide/upgrading_version_7.html#javaapplication_api_cleanup
Per [1], usine of Task.project during task action execution is deprecated, and instead values should be captured during configuration. This commit replaces usage of Task.project and Task.rootProject by capturing variables during configuration as documented. [1]: https://docs.gradle.org/8.13/userguide/upgrading_version_7.html#task_project
Incidentally I did not happen to see #3354 from @arnaud-lacurie (hi Arnaud!) before doing this, but it is different: that fixes the warnings for building with a newer JDK using Gradle 9, but does not address the issues of feature and configuration deprecation within Gradle itself. |
arnaud-lacurie
approved these changes
May 25, 2025
normen662
pushed a commit
to normen662/fdb-record-layer
that referenced
this pull request
May 26, 2025
…#3358) When running `./gradlew shadowJar compileTestJava --warning-mode=all` on the current HEAD of `main` (68f805a), a number of warnings are produced for deprecated usages of Gradle configuration features. Upon fixing the trivial deprecations produced in the first pass, a second round of issues is also produced. This pull request fixes all of those, such that the command executes cleanly, without generating a Gradle problem report. Each class of issue is addressed in a separate commit (which contains links to the Gradle documentation showing the fix mechanism to be the recommended approach), but broadly speaking there are five categories: 1. Use of `destination` instead of `outputLocation` when configuring JUnit report output location ([docs](https://docs.gradle.org/8.13/dsl/org.gradle.api.reporting.Report.html#org.gradle.api.reporting.Report:destination)) 2. Consistent use of `key = value` assignment rather than "space assignment" or `propertyName(value)` assignment ([docs](https://docs.gradle.org/8.13/userguide/upgrading_version_8.html#groovy_space_assignment_syntax)) 3. Use of plugin blocks instead of conventions for the `Java` plugin ([docs](https://docs.gradle.org/8.13/userguide/upgrading_version_8.html#java_convention_deprecation)) 4. Use of plugin blocks instead of conventions for the `Application` plugin ([docs](https://docs.gradle.org/8.13/userguide/upgrading_version_8.html#application_convention_deprecation)) and applying the ensuing required cleanup from the Gradle 7 migration ([docs](https://docs.gradle.org/current/userguide/upgrading_version_7.html#javaapplication_api_cleanup)) 5. Stopping the use of `Task.project` in Task actions ([docs](https://docs.gradle.org/8.13/userguide/upgrading_version_7.html#task_project)). Other tasks which are not dependents of `shadowJar` or `compileTestJava` likely still use deprecated syntax or conventions - I will follow up with a second pull request to address those in future.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When running
./gradlew shadowJar compileTestJava --warning-mode=all
on the current HEAD ofmain
(68f805a), a number of warnings are produced for deprecated usages of Gradle configuration features. Upon fixing the trivial deprecations produced in the first pass, a second round of issues is also produced. This pull request fixes all of those, such that the command executes cleanly, without generating a Gradle problem report.Each class of issue is addressed in a separate commit (which contains links to the Gradle documentation showing the fix mechanism to be the recommended approach), but broadly speaking there are five categories:
destination
instead ofoutputLocation
when configuring JUnit report output location (docs)key = value
assignment rather than "space assignment" orpropertyName(value)
assignment (docs)Java
plugin (docs)Application
plugin (docs) and applying the ensuing required cleanup from the Gradle 7 migration (docs)Task.project
in Task actions (docs).Other tasks which are not dependents of
shadowJar
orcompileTestJava
likely still use deprecated syntax or conventions - I will follow up with a second pull request to address those in future.