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 on latest JDK, but run tests on several #664

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jrodbx
Copy link
Collaborator

@jrodbx jrodbx commented Dec 17, 2022

[11, 12, 16, 18].each { majorVersion ->
def jdkTest = tasks.register("testJdk$majorVersion", Test) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(majorVersion)
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this also change GradleRunner's JVM?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question, I'm not sure. @JakeWharton ?

Copy link
Contributor

Choose a reason for hiding this comment

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

When I was having "fun" with Java and Gradle versions, I added this println to always see what's up:
https://github.com/TWiStErRob/net.twisterrob.gradle/blob/master/test/src/main/kotlin/net/twisterrob/gradle/test/GradleRunnerRule.kt#L159

(I didn't yet do what Jake suggested in his blog in my Gradle setup.)

[11, 12, 16, 18].each { majorVersion ->
def jdkTest = tasks.register("testJdk$majorVersion", Test) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(majorVersion)
Copy link
Contributor

Choose a reason for hiding this comment

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

// Avoid the native projects in 'libs'
plugins.withId('org.jetbrains.kotlin.jvm') {
// Create a test task for each supported JDK.
[11, 12, 16, 18].each { majorVersion ->
Copy link
Member

Choose a reason for hiding this comment

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

Should really include 17 as some vendors declared that an LTS release so the probability that someone will have it is high.

@JakeWharton
Copy link
Member

JakeWharton commented Dec 20, 2022

I assume the failure is because AdoptOpenJDK (which doesn't even exist anymore) deletes versions which they don't didn't provide as LTS. You're much better off with Zulu since they never delete any builds. All major versions, all minor versions, all patch versions, all architectures. They're all there.

You can get Gradle to provision Azul Zulu via https://github.com/gradle/foojay-toolchains and specifying "Zulu" as the vendor.

@jrodbx jrodbx force-pushed the jrod/2022-12-17/build-once-run-each branch 3 times, most recently from 15db26d to cf01a87 Compare May 20, 2023 00:12
@jrodbx jrodbx force-pushed the jrod/2022-12-17/build-once-run-each branch from cf01a87 to 1d8f00d Compare May 20, 2023 00:22
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

Successfully merging this pull request may close these issues.

None yet

3 participants