-
-
Notifications
You must be signed in to change notification settings - Fork 37
Cleanup Gradle buildscripts and fix deprecations #73
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
PaintNinja
merged 10 commits into
MinecraftForge:master
from
Jonathing:feat/jonathing/7.0/gradle-cleanup
May 10, 2025
Merged
Cleanup Gradle buildscripts and fix deprecations #73
PaintNinja
merged 10 commits into
MinecraftForge:master
from
Jonathing:feat/jonathing/7.0/gradle-cleanup
May 10, 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
- Added global repositories - Removed repository declarations from individual projects - Added plugins to the version catalog - Projects now use the plugin aliases - Removed unused libraries - Cleaned up and standardized the syntax for the version catalog
- PomUtils is now designed to be directly referenced - Declared common values like display name and vendor at top of the script - Replaced `gitversion.version` with `gitversion` - Using `licenses { license }` instead of `license` in MavenPOM - The base `license` method is not part of MavenPOM but rather DefaultMavenPOM, Gradle's own implementation of MavenPOM, which is internal and should not be referenced directly.
EventBus 7 is currently using type-safe project accessors, and this mandates that each included build has its name properly declared. Since buildSrc is an included build, its name is now declared in its own `settings.gradle` file.
As an included build, buildSrc does not share the EventBus project's version catalog. As such, I've created its own and am using it here.
The test projects are creating custom tasks and are lazily configuring their properties in their buildscripts. However, they are using Project#file which eagerly resolves the file object before passing it into the task property. This can result to issues in future Gradle versions where practices involving eager resolution are discouraged. I've replaced these usages with invocations to `ProjectLayout`, which can be accessed directly in the script or by using the `project` object as I've done here. This allows defining a file or directory location without eager resolution, putting their values in a provider that can then be passed into the task inputs without issue.
In Gradle 9, Gradle is removing the default conventions for custom testing tasks created by consumer projects. I've declared the proper classpaths using `Test#classpath` and `Test#testClassesDirs` to silence the warning in the problems report and to ensure Gradle 9 compatibility.
To simplify buildscripts and to prevent needing to change multiple values if need be, we've begun naming projects based on their artifact names and using that in the maven publications instead of manually writing out the desired artifact name (potentially multiple times). This required changing the project name from "EventBus" to "eventbus".
Minor nitpicks to improve consistency. We do not use any plugins that are hosted only on the Forge maven, so I have removed it from the plugin management repositories.
PaintNinja
requested changes
Apr 26, 2025
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.
Running ./gradlew jmh
fails for me: https://scans.gradle.com/s/z7oofla5lgive
ERROR: org.openjdk.jmh.runner.RunnerException: Can not touch the result file: fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedFile, C:\Users\oscar\Documents\GitHub\PaintNinja\EventBus\eventbus-jmh\build\jmh_results\jmh-Adoptium-21.json)
I probably forgot to ensure the parent directory. Whoops. |
PaintNinja
approved these changes
May 10, 2025
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.
Name entails. Gradle should no longer complain or generate problem reports with this project.
I've split each part of this into its own commit, each with its own justification in its commit description.