-
Notifications
You must be signed in to change notification settings - Fork 314
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
Use Gradle toolchains to build ORT with a consistent Java version #8411
Conversation
See [1]. [1]: https://docs.gradle.org/current/userguide/writing_build_scripts.html#script-default-imports Signed-off-by: Sebastian Schuberth <[email protected]>
The bogus warning from [1] cannot be reproduced anymore when running ./gradlew --rerun-tasks --no-build-cache --no-configuration-cache \ :buildSrc:build [1]: https://youtrack.jetbrains.com/issue/KT-48745 Signed-off-by: Sebastian Schuberth <[email protected]>
30e85e1
to
49c08db
Compare
The previous code was calling `JavaVersion.current()` at build time, assuming that the Java version running Gradle is the same Java version used for building ORT. This assumption makes it more difficult to build ORT for different Java versions in the same environment. Solve that by using Gradle's toolchains mechanism [1] instead. Choose Java 11 as the default for the new `javaLanguageVersion` property to support analyzing older projects with ORT, also see [2]. [1]: https://docs.gradle.org/current/userguide/toolchains.html [2]: #8249 Signed-off-by: Sebastian Schuberth <[email protected]>
Ensure to get values in exactly the same way as main ORT itself does. Signed-off-by: Sebastian Schuberth <[email protected]>
Signed-off-by: Sebastian Schuberth <[email protected]>
49c08db
to
93a7f37
Compare
@@ -23,6 +23,9 @@ org.gradle.parallel = true | |||
|
|||
kotlin.code.style = official | |||
|
|||
# The version of the JDK to use for building ORT. | |||
javaLanguageVersion = 11 |
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.
BTW, I'd be fine with giving this another / shorter name. Maybe just buildJdk
?
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.
I'm fine with either name, but add javaToolchainVersion
to the candidates.
Based on this, we could also do some simplifications regarding the GitHub workflows and Docker images, but I'll do these separately as a follow-up. |
@@ -23,6 +23,9 @@ org.gradle.parallel = true | |||
|
|||
kotlin.code.style = official | |||
|
|||
# The version of the JDK to use for building ORT. | |||
javaLanguageVersion = 11 |
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.
I'm fine with either name, but add javaToolchainVersion
to the candidates.
See #8414 for a start. |
Please have a look at the individual commit messages for the details.