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

build: require java 17+ and update readme #2448

Merged
merged 4 commits into from
Apr 1, 2023

Conversation

ImMorpheus
Copy link
Contributor

MC 1.18+ require java 17+

Update readme accordingly and replace old links

@@ -22,6 +22,6 @@ plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version ("0.3.0")
}

if (JavaVersion.current() < JavaVersion.VERSION_11) {
throw GradleException("SpongeAPI requires at least Java 11 to build, but you have ${JavaVersion.current()}.")
if (JavaVersion.current() < JavaVersion.VERSION_17) {
Copy link
Member

Choose a reason for hiding this comment

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

The Java version required to run gradle does not necessarily have to be the Java version used to compile -- this is just for buildscript plugins (iirc originally checkstyle) to run.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we optimize for the majority ? I'm thinking most people clone the repo to tinker/contribute so they probably want to build it. Any thoughts ?

Copy link
Member

Choose a reason for hiding this comment

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

Well, you can build either way -- if you're running on an older Java version, Gradle will try to detect the Java 17 JVM or if necessary download it -- it's easier to be more lenient rather than making devs muck around with their environment variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, didn't know that. Followup question: what is the check used for ? Woudn't it be best to remove and let gradle handle the java version then ? I'm not sure why we are specifically enforcing 11

Copy link
Member

Choose a reason for hiding this comment

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

I believe I added that check because newer versions of Checkstyle require J11 and Gradle didn't yet support toolchains on the checkstyle task at the time (it does now, so that could be configured to use the project toolchain instead and this check could be removed)

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 see we are not using the checkstyle plugin directly but we're relying on indra which has the toolchain version set (https://github.com/SpongePowered/SpongeAPI/blob/api-10/build.gradle.kts#L258). Shouldn't it take care of it ?

@zml2008
Copy link
Member

zml2008 commented Jan 8, 2023

This does however bring up the issue of the CI running gradle with Java 11, which is a bit redundant since 17 will have to be downloaded by Gradle anyways.

You should be able to add a runtime_version: 17 to the with: block on all the shared workflow actions used in SpongeAPI to avoid that. (as defined in the shared workflows)

@ImMorpheus
Copy link
Contributor Author

This does however bring up the issue of the CI running gradle with Java 11, which is a bit redundant since 17 will have to be downloaded by Gradle anyways.

You should be able to add a runtime_version: 17 to the with: block on all the shared workflow actions used in SpongeAPI to avoid that. (as defined in the shared workflows)

Thanks, had to dig into the common workflows 😄

@ImMorpheus ImMorpheus added the api: 10 version: 1.19 label Jan 21, 2023
@ImMorpheus ImMorpheus merged commit 25fc619 into api-10 Apr 1, 2023
@ImMorpheus ImMorpheus deleted the build/update-readme-jdk-17 branch April 1, 2023 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: 10 version: 1.19
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants