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

Convert to Gradle Kotlin DSL #4175

Draft
wants to merge 25 commits into
base: master
Choose a base branch
from
Draft

Conversation

md5sha256
Copy link
Contributor

@md5sha256 md5sha256 commented Apr 22, 2024

Description

PoC of using Gradle as the buildscript

Proposed changes

Remove all maven buildscripts
Use the gradle wrapper and the gradle Kotlin DSL for buildscripts
Bumped minimum Java version to 17 due to dependency incompatibilities with Authlib being compiled against java 17.

Related Issues (if applicable)

Checklist

  • I have fully tested the proposed changes and promise that they will not break everything into chaos.
  • I have also tested the proposed changes in combination with various popular addons and can confirm my changes do not break them.
  • I have made sure that the proposed changes do not break compatibility across the supported Minecraft versions (1.16.* - 1.20.*).
  • I followed the existing code standards and didn't mess up the formatting.
  • I did my best to add documentation to any public classes or methods I added.
  • I have added Nonnull and Nullable annotations to my methods to indicate their behaviour for null values
  • I added sufficient Unit Tests to cover my code.

Copy link
Contributor

Pro Tip!
You can help us label your Pull Requests by using the following branch naming convention next time you create a pull request. ❤️

Branch naming convention Label
feature/** 🎈 Feature
fix/** ✨ Fix
chore/** 🧹 Chores
api/** 🔧 API
performance/** 💡 Performance Optimization
compatibility/** 🤝 Compatibility

If your changes do not fall into any of these categories, don't worry. You can just ignore this message in that case! 👀

Copy link
Contributor

Slimefun preview build

A Slimefun preview build is available for testing!
Commit: bfb6574f

https://preview-builds.walshy.dev/download/Slimefun/4175/bfb6574f

Note: This is not a supported build and is only here for the purposes of testing.
Do not run this on a live server and do not report bugs anywhere but this PR!

@md5sha256
Copy link
Contributor Author

Noticed intellij has an error with ./gradlew clean build if ran from within the IDE. Possible fixes have something to do with re-specifying the javaagent. Running it via CLI is fine though.

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Grant Wrapper Permission
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we do this locally once (and push) instead of doing it every time in every task we want to invoke gradle

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure how the actions work so will need to figure out what you mean by that exactly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build.gradle.kts Outdated Show resolved Hide resolved
build.gradle.kts Outdated
Comment on lines 94 to 97
assemble {
dependsOn(shadowJar)

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assemble {
dependsOn(shadowJar)
}

This bit is unneeded, shadowJar automatically assembles

Copy link
Contributor Author

@md5sha256 md5sha256 Apr 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but assemble does not automatically shadow. Without this calling gradle build will only build the unshaded jar. Nonetheless, we can remove this and just do gradle shadowJar

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep that's what I do with my gradle spigot plugins, no need to attach it to build

build.gradle.kts Show resolved Hide resolved
Comment on lines +116 to +123
include("plugin.yml")
include("config.yml")
include("item-models.yml")
include("wiki.json")
include("languages/translators.json")
include("tags/*.json")
include("biome-maps/*.json")
include("languages/**/*.yml")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really needed? AFAIK all resources are automatically included

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, I'd have thought so too but I wonder why it was explicitly declared in the pom so I honored that explicit declaration. Can remove if there are no other reasons for it being explicitly declared.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can confirm all stuff is automatically included without that code

include("tags/*.json")
include("biome-maps/*.json")
include("languages/**/*.yml")
filesMatching("plugin.yml") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be replaced with the plugin-yml gradle plugin, tho idk how much others will want it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, haven't gotten to that part yet so I left it as we used to with maven resource filtering.

build.gradle.kts Outdated Show resolved Hide resolved
@TheBusyBot TheBusyBot added the ⚡ Merge Conflicts This Pull Request has merged conflicts which need to be resolved! label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚡ Merge Conflicts This Pull Request has merged conflicts which need to be resolved!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants