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

Gradle Build: Exact JDK version (major.minor.patch) provisioning #12798

Closed
Tracked by #11230
jjohannes opened this issue Apr 15, 2024 · 2 comments
Closed
Tracked by #11230

Gradle Build: Exact JDK version (major.minor.patch) provisioning #12798

jjohannes opened this issue Apr 15, 2024 · 2 comments
Assignees

Comments

@jjohannes
Copy link
Collaborator

jjohannes commented Apr 15, 2024

The JDK we currently use on CI is 21.0.1. The exact version is important as it is written into module-info.class files. That's why we add it as input. Gradle's toolchain mechanism currently only tracks the major version. That's why we need the full version as a separate input:

https://github.com/hashgraph/hedera-services/blob/develop/build-logic/project-plugins/src/main/kotlin/com.hedera.hashgraph.java.gradle.kts#L126-L130

(Note: the code is not 100% correct atm. It uses the version of the JDK running Gradle. On local machines, this may be a different version than the one provisioned by toolchains if Gradle is started with a different "major" JDK.)

Right now, users starting Gradle with a different JDK than 21.0.1 will not get any remote cache hits for compilation!

If we can't get this working reliably with toolchains (see gradle/gradle#16628 (comment)) we should probably make sure the version we want is exactly the one Gradle was started with and let Gradle use that one. For that we could do a more precise version of the check proposed in: #12780

@jjohannes
Copy link
Collaborator Author

This PR solves this by not using the Gradle Java Toolchains feature anymore: #13108

With future Gradle and Gradle plugin versions, we may be able to move to a better setup. The following things need to be addressed upstream:

@jjohannes jjohannes changed the title Gradle: Find a way to use the same JDK major.minor.patch version everywhere Gradle: Exact JDK version (major.minor.patch) provisioning May 7, 2024
@jjohannes jjohannes changed the title Gradle: Exact JDK version (major.minor.patch) provisioning Gradle Build: Exact JDK version (major.minor.patch) provisioning May 7, 2024
@jjohannes
Copy link
Collaborator Author

The implemented solution solves the problem. Closing this issue, since there is nothing we can improve until Gradle core delivers new/better features in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant