From 75a946e6d41cdd700a7772b134cc370683cd1aaf Mon Sep 17 00:00:00 2001 From: Claudia Rogoz Date: Fri, 22 Nov 2024 14:32:57 +0100 Subject: [PATCH 01/14] java versions --- .../gradle/jdks/GradleJdkTestUtils.groovy | 4 ++- .../jdks/JdkDistributionConfigurator.java | 8 ++++-- .../palantir/gradle/jdks/JdksExtension.java | 11 ++++++++ .../jdks/GradleJdkIntegrationSpec.groovy | 4 +++ .../GradleJdkToolchainsIntegrationTest.groovy | 25 +++++++++++++++++++ 5 files changed, 49 insertions(+), 3 deletions(-) diff --git a/gradle-jdks-test-common/src/main/groovy/com/palantir/gradle/jdks/GradleJdkTestUtils.groovy b/gradle-jdks-test-common/src/main/groovy/com/palantir/gradle/jdks/GradleJdkTestUtils.groovy index e3c5d455..33ed20cc 100644 --- a/gradle-jdks-test-common/src/main/groovy/com/palantir/gradle/jdks/GradleJdkTestUtils.groovy +++ b/gradle-jdks-test-common/src/main/groovy/com/palantir/gradle/jdks/GradleJdkTestUtils.groovy @@ -97,7 +97,7 @@ class GradleJdkTestUtils { .stripIndent(true) } - static setupJdksHardcodedVersions(File settingsFile, File buildFile, String daemonJdkVersion = DAEMON_MAJOR_VERSION_11) { + static setupJdksHardcodedVersions(File settingsFile, File buildFile, String daemonJdkVersion = DAEMON_MAJOR_VERSION_11, boolean onlyIncludeDaemonJdk = false) { applyJdksPlugins(settingsFile, buildFile) @@ -120,6 +120,7 @@ class GradleJdkTestUtils { } daemonTarget = DAEMON_MAJOR_VERSION_11 + daemonJdkOnly = DAEMON_JDK_ONLY } """.replace("JDK_11_DISTRO", quoted(JDK_11.getLeft())) .replace("JDK_11_VERSION", quoted(JDK_11.getRight())) @@ -128,6 +129,7 @@ class GradleJdkTestUtils { .replace("JDK_21_DISTRO", quoted(JDK_21.getLeft())) .replace("JDK_21_VERSION", quoted(JDK_21.getRight())) .replace("DAEMON_MAJOR_VERSION_11", quoted(daemonJdkVersion)) + .replace("DAEMON_JDK_ONLY", onlyIncludeDaemonJdk.toString()) .stripIndent(true) } diff --git a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdkDistributionConfigurator.java b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdkDistributionConfigurator.java index 6408069f..29080092 100644 --- a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdkDistributionConfigurator.java +++ b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdkDistributionConfigurator.java @@ -38,8 +38,12 @@ public final class JdkDistributionConfigurator { public static Map> getJavaVersionToJdkDistros( Project project, JdkDistributions jdkDistributions, JdksExtension jdksExtension) { - Set javaVersions = Arrays.stream(JavaVersion.values()) - .map(javaVersion -> JavaLanguageVersion.of(javaVersion.getMajorVersion())) + Stream requestedJavaVersions = + jdksExtension.getDaemonJdkOnly().get() + ? Stream.of(jdksExtension.getDaemonTarget().get()) + : Arrays.stream(JavaVersion.values()) + .map(javaVersion -> JavaLanguageVersion.of(javaVersion.getMajorVersion())); + Set javaVersions = requestedJavaVersions .filter(javaLanguageVersion -> javaLanguageVersion.canCompileOrRun(MINIMUM_SUPPORTED_JAVA_VERSION)) .collect(Collectors.toSet()); return javaVersions.stream() diff --git a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java index 687fee6d..57461704 100644 --- a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java +++ b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java @@ -36,6 +36,7 @@ public abstract class JdksExtension { private final MapProperty caCerts; private final DirectoryProperty jdkStorageLocation; private final Property daemonTarget; + private final Property daemonJdkOnly; @Inject protected abstract ObjectFactory getObjectFactory(); @@ -57,9 +58,11 @@ public JdksExtension() { this.jdkStorageLocation = SynchronizedInterface.synchronizeAllInterfaceMethods( DirectoryProperty.class, getObjectFactory().directoryProperty()); this.daemonTarget = getObjectFactory().property(JavaLanguageVersion.class); + this.daemonJdkOnly = getObjectFactory().property(Boolean.class); this.getCaCerts().finalizeValueOnRead(); this.getJdkStorageLocation().finalizeValueOnRead(); this.getDaemonTarget().finalizeValueOnRead(); + this.getDaemonJdkOnly().finalizeValueOnRead(); } public final Property getDaemonTarget() { @@ -74,6 +77,14 @@ public final void setDaemonTarget(int value) { getDaemonTarget().set(JavaLanguageVersion.of(value)); } + public final Property getDaemonJdkOnly() { + return daemonJdkOnly; + } + + public final void setDaemonJdkOnly(Boolean value) { + getDaemonJdkOnly().set(value); + } + public final MapProperty getCaCerts() { return caCerts; } diff --git a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkIntegrationSpec.groovy b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkIntegrationSpec.groovy index be25aa72..8145f4b7 100644 --- a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkIntegrationSpec.groovy +++ b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkIntegrationSpec.groovy @@ -36,6 +36,10 @@ abstract class GradleJdkIntegrationSpec extends IntegrationSpec { GradleJdkTestUtils.setupJdksHardcodedVersions(settingsFile, buildFile, daemonTarget) } + def setupJdksHardcodedVersions(String daemonTarget, boolean onlyDaemonJdk) { + GradleJdkTestUtils.setupJdksHardcodedVersions(settingsFile, buildFile, daemonTarget, onlyDaemonJdk) + } + def applyApplicationPlugin() { GradleJdkTestUtils.applyApplicationPlugin(buildFile) } diff --git a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy index 0a05c0e9..bcda0031 100644 --- a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy +++ b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy @@ -21,9 +21,11 @@ import com.palantir.gradle.jdks.setup.common.CurrentOs import org.apache.commons.lang3.tuple.Pair import spock.lang.TempDir +import java.nio.file.Files import java.nio.file.Path import java.util.regex.Matcher import java.util.regex.Pattern +import java.util.stream.Collectors class GradleJdkToolchainsIntegrationTest extends GradleJdkIntegrationSpec { @@ -156,6 +158,9 @@ class GradleJdkToolchainsIntegrationTest extends GradleJdkIntegrationSpec { Path daemonJvm = workingDir().resolve("gradle-jdks").resolve(daemonJdkFileName).toAbsolutePath() gradleHomeOutput.contains("java.home: ${daemonJvm}") + then: 'generates directories for all jdk versions' + Files.list(projectDir.toPath().resolve("gradle/jdks")).map {it -> it.getFileName()}.collect(Collectors.toList()).equals(List.of("11", "17", "21")) + when: 'compiling projects' def output = runGradlewTasksSuccessfully("compileJava", "--info") @@ -175,6 +180,26 @@ class GradleJdkToolchainsIntegrationTest extends GradleJdkIntegrationSpec { gradleVersionNumber << GRADLE_TEST_VERSIONS } + + def '#gradleVersionNumber: only generates daemon jdk'() { + gradleVersion = gradleVersionNumber + setupJdksHardcodedVersions('11', true) + applyBaselineJavaVersions() + applyApplicationPlugin() + + file('gradle.properties') << 'palantir.jdk.setup.enabled=true' + file('src/main/java/Main.java') << java17PreviewCode + + when: + runTasksSuccessfully('wrapper') + + then: 'only jdk 11 is generated' + Files.list(projectDir.toPath().resolve("gradle/jdks")).allMatch { it -> it.endsWith("gradle/jdks/11")} + + where: + gradleVersionNumber << GRADLE_TEST_VERSIONS + } + def '#gradleVersionNumber: fails if the jdk version is not configured'() { setupJdksHardcodedVersions() applyBaselineJavaVersions() From 7a71212ecb8991cfb85813dbd09161f5e106b088 Mon Sep 17 00:00:00 2001 From: Claudia Rogoz Date: Fri, 22 Nov 2024 14:45:06 +0100 Subject: [PATCH 02/14] default ot false --- .../src/main/java/com/palantir/gradle/jdks/JdksExtension.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java index 57461704..3c656e7b 100644 --- a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java +++ b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java @@ -62,7 +62,7 @@ public JdksExtension() { this.getCaCerts().finalizeValueOnRead(); this.getJdkStorageLocation().finalizeValueOnRead(); this.getDaemonTarget().finalizeValueOnRead(); - this.getDaemonJdkOnly().finalizeValueOnRead(); + this.getDaemonJdkOnly().convention(false); } public final Property getDaemonTarget() { From 48ec4979f0ec420e9eda314140732eb151674ef8 Mon Sep 17 00:00:00 2001 From: Claudia Rogoz Date: Fri, 22 Nov 2024 14:56:47 +0100 Subject: [PATCH 03/14] . --- .../gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy index bcda0031..93b32a6a 100644 --- a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy +++ b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy @@ -159,7 +159,7 @@ class GradleJdkToolchainsIntegrationTest extends GradleJdkIntegrationSpec { gradleHomeOutput.contains("java.home: ${daemonJvm}") then: 'generates directories for all jdk versions' - Files.list(projectDir.toPath().resolve("gradle/jdks")).map {it -> it.getFileName()}.collect(Collectors.toList()).equals(List.of("11", "17", "21")) + Files.list(projectDir.toPath().resolve("gradle/jdks")).map { it -> it.getFileName().toString() }.collect(Collectors.toList()).containsAll(List.of("11", "17", "21")) when: 'compiling projects' def output = runGradlewTasksSuccessfully("compileJava", "--info") From 7a57614147a0e219dea9738dd62403d777d43e31 Mon Sep 17 00:00:00 2001 From: svc-changelog Date: Fri, 22 Nov 2024 14:17:20 +0000 Subject: [PATCH 04/14] Add generated changelog entries --- changelog/@unreleased/pr-472.v2.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/@unreleased/pr-472.v2.yml diff --git a/changelog/@unreleased/pr-472.v2.yml b/changelog/@unreleased/pr-472.v2.yml new file mode 100644 index 00000000..8706d883 --- /dev/null +++ b/changelog/@unreleased/pr-472.v2.yml @@ -0,0 +1,5 @@ +type: fix +fix: + description: Add `daemonJdkOnly ` property for gradle jdk directory generation + links: + - https://github.com/palantir/gradle-jdks/pull/472 From dbc81da13f9cdd4a42d30542e9590414181c326d Mon Sep 17 00:00:00 2001 From: Claudia Rogoz Date: Mon, 25 Nov 2024 11:47:21 +0100 Subject: [PATCH 05/14] address comments --- .../gradle/jdks/GradleJdkTestUtils.groovy | 4 +-- .../jdks/JdkDistributionConfigurator.java | 8 +----- .../palantir/gradle/jdks/JdksExtension.java | 26 ++++++++++++++----- .../jdks/GradleJdkIntegrationSpec.groovy | 4 --- .../GradleJdkToolchainsIntegrationTest.groovy | 9 ++++++- 5 files changed, 29 insertions(+), 22 deletions(-) diff --git a/gradle-jdks-test-common/src/main/groovy/com/palantir/gradle/jdks/GradleJdkTestUtils.groovy b/gradle-jdks-test-common/src/main/groovy/com/palantir/gradle/jdks/GradleJdkTestUtils.groovy index 33ed20cc..e3c5d455 100644 --- a/gradle-jdks-test-common/src/main/groovy/com/palantir/gradle/jdks/GradleJdkTestUtils.groovy +++ b/gradle-jdks-test-common/src/main/groovy/com/palantir/gradle/jdks/GradleJdkTestUtils.groovy @@ -97,7 +97,7 @@ class GradleJdkTestUtils { .stripIndent(true) } - static setupJdksHardcodedVersions(File settingsFile, File buildFile, String daemonJdkVersion = DAEMON_MAJOR_VERSION_11, boolean onlyIncludeDaemonJdk = false) { + static setupJdksHardcodedVersions(File settingsFile, File buildFile, String daemonJdkVersion = DAEMON_MAJOR_VERSION_11) { applyJdksPlugins(settingsFile, buildFile) @@ -120,7 +120,6 @@ class GradleJdkTestUtils { } daemonTarget = DAEMON_MAJOR_VERSION_11 - daemonJdkOnly = DAEMON_JDK_ONLY } """.replace("JDK_11_DISTRO", quoted(JDK_11.getLeft())) .replace("JDK_11_VERSION", quoted(JDK_11.getRight())) @@ -129,7 +128,6 @@ class GradleJdkTestUtils { .replace("JDK_21_DISTRO", quoted(JDK_21.getLeft())) .replace("JDK_21_VERSION", quoted(JDK_21.getRight())) .replace("DAEMON_MAJOR_VERSION_11", quoted(daemonJdkVersion)) - .replace("DAEMON_JDK_ONLY", onlyIncludeDaemonJdk.toString()) .stripIndent(true) } diff --git a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdkDistributionConfigurator.java b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdkDistributionConfigurator.java index 29080092..89f5c801 100644 --- a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdkDistributionConfigurator.java +++ b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdkDistributionConfigurator.java @@ -25,7 +25,6 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.gradle.api.JavaVersion; import org.gradle.api.Project; import org.gradle.api.logging.Logger; import org.gradle.api.logging.Logging; @@ -38,12 +37,7 @@ public final class JdkDistributionConfigurator { public static Map> getJavaVersionToJdkDistros( Project project, JdkDistributions jdkDistributions, JdksExtension jdksExtension) { - Stream requestedJavaVersions = - jdksExtension.getDaemonJdkOnly().get() - ? Stream.of(jdksExtension.getDaemonTarget().get()) - : Arrays.stream(JavaVersion.values()) - .map(javaVersion -> JavaLanguageVersion.of(javaVersion.getMajorVersion())); - Set javaVersions = requestedJavaVersions + Set javaVersions = jdksExtension.getJdkMajorVersionsToUse().get().stream() .filter(javaLanguageVersion -> javaLanguageVersion.canCompileOrRun(MINIMUM_SUPPORTED_JAVA_VERSION)) .collect(Collectors.toSet()); return javaVersions.stream() diff --git a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java index 3c656e7b..19c00bac 100644 --- a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java +++ b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java @@ -20,14 +20,20 @@ import com.palantir.gradle.utils.lazilyconfiguredmapping.LazilyConfiguredMapping; import groovy.lang.Closure; import groovy.lang.DelegatesTo; +import java.util.Arrays; +import java.util.List; import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; import javax.inject.Inject; import org.gradle.api.Action; +import org.gradle.api.JavaVersion; import org.gradle.api.Project; import org.gradle.api.file.DirectoryProperty; import org.gradle.api.model.ObjectFactory; import org.gradle.api.provider.MapProperty; import org.gradle.api.provider.Property; +import org.gradle.api.provider.SetProperty; import org.gradle.jvm.toolchain.JavaLanguageVersion; public abstract class JdksExtension { @@ -36,7 +42,7 @@ public abstract class JdksExtension { private final MapProperty caCerts; private final DirectoryProperty jdkStorageLocation; private final Property daemonTarget; - private final Property daemonJdkOnly; + private final SetProperty jdkMajorVersionsToUse; @Inject protected abstract ObjectFactory getObjectFactory(); @@ -58,11 +64,13 @@ public JdksExtension() { this.jdkStorageLocation = SynchronizedInterface.synchronizeAllInterfaceMethods( DirectoryProperty.class, getObjectFactory().directoryProperty()); this.daemonTarget = getObjectFactory().property(JavaLanguageVersion.class); - this.daemonJdkOnly = getObjectFactory().property(Boolean.class); + this.jdkMajorVersionsToUse = getObjectFactory().setProperty(JavaLanguageVersion.class); + this.jdkMajorVersionsToUse.convention(Arrays.stream(JavaVersion.values()) + .map(javaVersion -> JavaLanguageVersion.of(javaVersion.getMajorVersion())) + .collect(Collectors.toSet())); this.getCaCerts().finalizeValueOnRead(); this.getJdkStorageLocation().finalizeValueOnRead(); this.getDaemonTarget().finalizeValueOnRead(); - this.getDaemonJdkOnly().convention(false); } public final Property getDaemonTarget() { @@ -77,12 +85,16 @@ public final void setDaemonTarget(int value) { getDaemonTarget().set(JavaLanguageVersion.of(value)); } - public final Property getDaemonJdkOnly() { - return daemonJdkOnly; + public final SetProperty getJdkMajorVersionsToUse() { + return this.jdkMajorVersionsToUse; } - public final void setDaemonJdkOnly(Boolean value) { - getDaemonJdkOnly().set(value); + public final void setJdkMajorVersionsToUse(List javaLanguageVersions) { + this.jdkMajorVersionsToUse.set(javaLanguageVersions); + } + + public final void daemonJdkOnly() { + this.jdkMajorVersionsToUse.set(daemonTarget.map(Set::of)); } public final MapProperty getCaCerts() { diff --git a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkIntegrationSpec.groovy b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkIntegrationSpec.groovy index 8145f4b7..be25aa72 100644 --- a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkIntegrationSpec.groovy +++ b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkIntegrationSpec.groovy @@ -36,10 +36,6 @@ abstract class GradleJdkIntegrationSpec extends IntegrationSpec { GradleJdkTestUtils.setupJdksHardcodedVersions(settingsFile, buildFile, daemonTarget) } - def setupJdksHardcodedVersions(String daemonTarget, boolean onlyDaemonJdk) { - GradleJdkTestUtils.setupJdksHardcodedVersions(settingsFile, buildFile, daemonTarget, onlyDaemonJdk) - } - def applyApplicationPlugin() { GradleJdkTestUtils.applyApplicationPlugin(buildFile) } diff --git a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy index 93b32a6a..a4273953 100644 --- a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy +++ b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy @@ -183,10 +183,17 @@ class GradleJdkToolchainsIntegrationTest extends GradleJdkIntegrationSpec { def '#gradleVersionNumber: only generates daemon jdk'() { gradleVersion = gradleVersionNumber - setupJdksHardcodedVersions('11', true) + setupJdksHardcodedVersions('11') applyBaselineJavaVersions() applyApplicationPlugin() + // language=groovy + buildFile << """ + jdks { + daemonJdkOnly() + } + """.stripIndent(true) + file('gradle.properties') << 'palantir.jdk.setup.enabled=true' file('src/main/java/Main.java') << java17PreviewCode From 33ab223027d807538d3b56de1017dbd65027e8d4 Mon Sep 17 00:00:00 2001 From: Claudia Rogoz Date: Mon, 25 Nov 2024 12:11:03 +0100 Subject: [PATCH 06/14] readme --- gradle-jdks-setup/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gradle-jdks-setup/README.md b/gradle-jdks-setup/README.md index 1b0032c0..710aabe9 100644 --- a/gradle-jdks-setup/README.md +++ b/gradle-jdks-setup/README.md @@ -89,6 +89,8 @@ jdks { ``` jdks { daemonTarget = + daemonOnly() # optional, only installs & configures the daemon JDK version + jdkVersionsToUse = # optional, the set of java versions to install, by default it will contain all the major versions configured in step 3. } ``` 5. Enable the jdk setup by adding the following to `gradle.properties`: From 25ce2999d417316ce6eae944509153fff8b8f629 Mon Sep 17 00:00:00 2001 From: Claudia Rogoz Date: Mon, 25 Nov 2024 14:19:33 +0100 Subject: [PATCH 07/14] fix --- .../palantir/gradle/jdks/JdksExtension.java | 3 +- .../gradle/jdks/ToolchainsPlugin.java | 35 ++++++++++++++++--- .../GradleJdkToolchainsIntegrationTest.groovy | 35 +++++++++++++++++++ 3 files changed, 66 insertions(+), 7 deletions(-) diff --git a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java index 19c00bac..ca8a42fe 100644 --- a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java +++ b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java @@ -21,7 +21,6 @@ import groovy.lang.Closure; import groovy.lang.DelegatesTo; import java.util.Arrays; -import java.util.List; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -89,7 +88,7 @@ public final SetProperty getJdkMajorVersionsToUse() { return this.jdkMajorVersionsToUse; } - public final void setJdkMajorVersionsToUse(List javaLanguageVersions) { + public final void setJdkMajorVersionsToUse(Set javaLanguageVersions) { this.jdkMajorVersionsToUse.set(javaLanguageVersions); } diff --git a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/ToolchainsPlugin.java b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/ToolchainsPlugin.java index 91ba14d8..05f4d1fd 100644 --- a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/ToolchainsPlugin.java +++ b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/ToolchainsPlugin.java @@ -16,14 +16,19 @@ package com.palantir.gradle.jdks; +import com.palantir.baseline.plugins.javaversions.BaselineJavaVersionExtension; import com.palantir.baseline.plugins.javaversions.BaselineJavaVersionsExtension; +import com.palantir.baseline.plugins.javaversions.ChosenJavaVersion; import com.palantir.gradle.jdks.GradleWrapperPatcher.GradleWrapperPatcherTask; import com.palantir.gradle.jdks.enablement.GradleJdksEnablement; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.gradle.api.Plugin; import org.gradle.api.Project; import org.gradle.api.Task; import org.gradle.api.logging.Logger; import org.gradle.api.logging.Logging; +import org.gradle.api.provider.Provider; import org.gradle.api.tasks.TaskProvider; import org.gradle.api.tasks.wrapper.Wrapper; import org.gradle.language.base.plugins.LifecycleBasePlugin; @@ -58,12 +63,32 @@ public void apply(Project rootProject) { JdksExtension jdksExtension = JdksPlugin.extension(rootProject, jdkDistributions); rootProject.getPluginManager().withPlugin("com.palantir.baseline-java-versions", unused -> { - rootProject - .getExtensions() - .getByType(BaselineJavaVersionsExtension.class) - .getSetupJdkToolchains() - .set(false); + BaselineJavaVersionsExtension baselineJavaVersionsExtension = + rootProject.getExtensions().getByType(BaselineJavaVersionsExtension.class); + baselineJavaVersionsExtension.getSetupJdkToolchains().set(false); + + jdksExtension.getJdkMajorVersionsToUse().set(rootProject.provider(() -> Stream.of( + jdksExtension.getDaemonTarget(), + baselineJavaVersionsExtension.libraryTarget(), + baselineJavaVersionsExtension.runtime().map(ChosenJavaVersion::javaLanguageVersion), + baselineJavaVersionsExtension + .distributionTarget() + .map(ChosenJavaVersion::javaLanguageVersion)) + .map(Provider::get) + .collect(Collectors.toSet()))); }); + + rootProject.subprojects( + proj -> proj.getPluginManager().withPlugin("com.palantir.baseline-java-version", unused -> { + BaselineJavaVersionExtension projectVersions = + proj.getExtensions().getByType(BaselineJavaVersionExtension.class); + + jdksExtension.getJdkMajorVersionsToUse().addAll(rootProject.provider(() -> Stream.of( + projectVersions.target(), projectVersions.runtime()) + .map(Provider::get) + .map(ChosenJavaVersion::javaLanguageVersion) + .collect(Collectors.toSet()))); + })); TaskProvider wrapperTask = rootProject.getTasks().named("wrapper", Wrapper.class); TaskProvider generateGradleJdkConfigs = rootProject diff --git a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy index a4273953..0dd5ad0c 100644 --- a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy +++ b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy @@ -180,6 +180,41 @@ class GradleJdkToolchainsIntegrationTest extends GradleJdkIntegrationSpec { gradleVersionNumber << GRADLE_TEST_VERSIONS } + def '#gradleVersionNumber: only required java versions are configured'() { + gradleVersion = gradleVersionNumber + setupJdksHardcodedVersions('17') + applyBaselineJavaVersions() + applyApplicationPlugin() + + file('gradle.properties') << 'palantir.jdk.setup.enabled=true' + file('src/main/java/Main.java') << java17PreviewCode + + // language=Groovy + buildFile << """ + javaVersions { + libraryTarget = '17' + } + """.stripIndent(true) + + //language=groovy + def subprojectLib21 = addSubproject 'subproject-lib-21', ''' + apply plugin: 'java-library' + javaVersion { + target = 21 + } + '''.stripIndent(true) + writeJavaSourceFile(getMainJavaCode(), subprojectLib21) + + when: + runTasksSuccessfully('wrapper') + + then: 'generates directories for all jdk versions' + Files.list(projectDir.toPath().resolve("gradle/jdks")).map { it -> it.getFileName().toString() }.collect(Collectors.toList()).containsAll(List.of("17", "21")) + + where: + gradleVersionNumber << GRADLE_TEST_VERSIONS + } + def '#gradleVersionNumber: only generates daemon jdk'() { gradleVersion = gradleVersionNumber From 2d592ff9b7c477c340fd1eb15c1e44c942f2f760 Mon Sep 17 00:00:00 2001 From: Claudia Rogoz Date: Mon, 25 Nov 2024 14:50:03 +0100 Subject: [PATCH 08/14] wip --- build.gradle | 4 +++- .../gradle/jdks/GradleJdksConfigs.java | 11 +++++++++++ gradle/gradle-jdks-setup.jar | Bin 112072 -> 112070 bytes .../jdks/21/linux-glibc/aarch64/download-url | 1 - gradle/jdks/21/linux-glibc/aarch64/local-path | 1 - .../jdks/21/linux-glibc/x86-64/download-url | 1 - gradle/jdks/21/linux-glibc/x86-64/local-path | 1 - .../jdks/21/linux-musl/aarch64/download-url | 1 - gradle/jdks/21/linux-musl/aarch64/local-path | 1 - gradle/jdks/21/linux-musl/x86-64/download-url | 1 - gradle/jdks/21/linux-musl/x86-64/local-path | 1 - gradle/jdks/21/macos/aarch64/download-url | 1 - gradle/jdks/21/macos/aarch64/local-path | 1 - gradle/jdks/21/macos/x86-64/download-url | 1 - gradle/jdks/21/macos/x86-64/local-path | 1 - gradle/jdks/21/windows/x86-64/download-url | 1 - gradle/jdks/21/windows/x86-64/local-path | 1 - 17 files changed, 14 insertions(+), 15 deletions(-) delete mode 100644 gradle/jdks/21/linux-glibc/aarch64/download-url delete mode 100644 gradle/jdks/21/linux-glibc/aarch64/local-path delete mode 100644 gradle/jdks/21/linux-glibc/x86-64/download-url delete mode 100644 gradle/jdks/21/linux-glibc/x86-64/local-path delete mode 100644 gradle/jdks/21/linux-musl/aarch64/download-url delete mode 100644 gradle/jdks/21/linux-musl/aarch64/local-path delete mode 100644 gradle/jdks/21/linux-musl/x86-64/download-url delete mode 100644 gradle/jdks/21/linux-musl/x86-64/local-path delete mode 100644 gradle/jdks/21/macos/aarch64/download-url delete mode 100644 gradle/jdks/21/macos/aarch64/local-path delete mode 100644 gradle/jdks/21/macos/x86-64/download-url delete mode 100644 gradle/jdks/21/macos/x86-64/local-path delete mode 100644 gradle/jdks/21/windows/x86-64/download-url delete mode 100644 gradle/jdks/21/windows/x86-64/local-path diff --git a/build.gradle b/build.gradle index 00ca5ca3..927c37de 100644 --- a/build.gradle +++ b/build.gradle @@ -2,12 +2,13 @@ buildscript { repositories { mavenCentral() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } } gradlePluginPortal() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } } + mavenLocal() } dependencies { classpath 'com.palantir.gradle.failure-reports:gradle-failure-reports:1.13.0' classpath 'com.palantir.jakartapackagealignment:jakarta-package-alignment:0.6.0' - classpath 'com.palantir.gradle.jdks:gradle-jdks:0.57.0' + classpath 'com.palantir.gradle.jdks:gradle-jdks:0.57.0-13-g25ce299' classpath 'com.palantir.gradle.jdkslatest:gradle-jdks-latest:0.16.0' classpath 'org.unbroken-dome.gradle-plugins:gradle-testsets-plugin:4.1.0' classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.19.0' @@ -42,6 +43,7 @@ allprojects { repositories { mavenCentral() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } } gradlePluginPortal() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } } + mavenLocal() } group 'com.palantir.gradle.jdks' diff --git a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/GradleJdksConfigs.java b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/GradleJdksConfigs.java index e2f2808d..3f82a0b1 100644 --- a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/GradleJdksConfigs.java +++ b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/GradleJdksConfigs.java @@ -27,9 +27,11 @@ import org.gradle.api.file.Directory; import org.gradle.api.provider.MapProperty; import org.gradle.api.provider.Property; +import org.gradle.api.provider.SetProperty; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.Nested; import org.gradle.api.tasks.TaskAction; +import org.gradle.api.tasks.options.Option; import org.gradle.jvm.toolchain.JavaLanguageVersion; /** @@ -43,6 +45,15 @@ public abstract class GradleJdksConfigs extends DefaultTask { public static final String GRADLE_JDKS_SETUP_SCRIPT = "gradle-jdks-setup.sh"; public static final String GRADLE_JDKS_FUNCTIONS_SCRIPT = "gradle-jdks-functions.sh"; + /** + * Option to include a specific java major version when generating/checking the gradle jdk configuration files. + */ + @Input + @Option( + option = "includeJava", + description = "Generates the jdk configuration directories for the Java major version.") + public abstract SetProperty getIncludedJavaMajorVersion(); + @Nested public abstract MapProperty> getJavaVersionToJdkDistros(); diff --git a/gradle/gradle-jdks-setup.jar b/gradle/gradle-jdks-setup.jar index 17ce8d02d35930d45f284e970fbcda34d0d18bb4..0cd1840ece6866015f4c1ca20264d44786ea0163 100644 GIT binary patch delta 7567 zcmY*;bzGF)^S1XA(&^IOE!`<4DGiFmf`CiON|&oBNY?_lbaywBN=TQ0bfZW~i6EiB zMW65UKJV@ydtKMenKLuz%>DW7Zr={}haK#yB`iYKqo5fr{2MpuXm8w*Lb*YCP*7|} zq%I}|R}IsYePd*xn8PQIOna8??sF=r=S(_V>h8C)+FHz#HmBR>PQ)&%{)}~V7|!@W zNp*RBd3|Bq{=`ywn^Wn>-~J-AyBsL0pNYdmE$#dM%ZI<)Pear*q<-Caew_G`$+cTY z$+-ugSL*PH$?qUslS_9$k;f9MB4Js+h7*M`(f7^0eg4jl}aT)a=(|9PR+^@81Yl^hlWLD9#r-Eg6Yz#N@NrkSM&Q z2X8%)oebZGXOq(wVH_y6A>B7{tn!m_(!fdvjqR=MKJmdw>e=0bhb+_*Wj{iK^5y3> z^Ip$E&!mT%vaOXw!#9)~b<<9GGGRzrO_lyTMX%}a+bBF%JTZ+*;2;y%g_60twM-S+q{b-|Q_nLoME zc9mmA+m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*cmzzX7}0#Xp_H#aie;LUAxcysW7b1o15t33`T z0e4f8)oz9VgYiLyG-OJ}vHxHUup|u-1ct%YG-NdM+<$0v&^;X)khK7b`ESaDLTUHY{|I=@DA`RMC?t6Lza%y|`vD*WUuGloHJkmbNzVrOfkSXC8yP=s;f8`QF5rL; zImpSfOYp$W2k_V>JdmOgnY7UAf0KqL<{~$DCTNli*g>o|k*1=z+kqkv>0WUAuY0{b zf&u~vfGOb$ z7nCSMw#yv#AB+j66e0D8Xn!$0a~2JJa0ejxdz8R_bl|@=H-o&z$P*xs`G2;Nm;m;z z?N~7~RV26x0}_@1f{-@c8z2DU;sLl|SP8N`529OUy9Akn49N`;0+maV@d?RqfiXEi z1%53-mcChvJXS@C2xNO%X>OHXGywUnau9(GW=VHTQGZsb-GsX!)8%XiD@ z@d4Dgvyz2?|L*Q+p<9DNA>>tda|MAUm47eR2bF*%DuD<9j|b?%xJp0@SOdo@0VCiU z$Xf*%ATPsM6gX*<_46qI+*8;5QOK$<>N&J7MyzsC9 diff --git a/gradle/jdks/21/linux-glibc/aarch64/download-url b/gradle/jdks/21/linux-glibc/aarch64/download-url deleted file mode 100644 index 43106141..00000000 --- a/gradle/jdks/21/linux-glibc/aarch64/download-url +++ /dev/null @@ -1 +0,0 @@ -https://corretto.aws/downloads/resources/21.0.5.11.1/amazon-corretto-21.0.5.11.1-linux-aarch64.tar.gz diff --git a/gradle/jdks/21/linux-glibc/aarch64/local-path b/gradle/jdks/21/linux-glibc/aarch64/local-path deleted file mode 100644 index 4c19e3ac..00000000 --- a/gradle/jdks/21/linux-glibc/aarch64/local-path +++ /dev/null @@ -1 +0,0 @@ -amazon-corretto-21.0.5.11.1 diff --git a/gradle/jdks/21/linux-glibc/x86-64/download-url b/gradle/jdks/21/linux-glibc/x86-64/download-url deleted file mode 100644 index 25c31a53..00000000 --- a/gradle/jdks/21/linux-glibc/x86-64/download-url +++ /dev/null @@ -1 +0,0 @@ -https://corretto.aws/downloads/resources/21.0.5.11.1/amazon-corretto-21.0.5.11.1-linux-x64.tar.gz diff --git a/gradle/jdks/21/linux-glibc/x86-64/local-path b/gradle/jdks/21/linux-glibc/x86-64/local-path deleted file mode 100644 index 4c19e3ac..00000000 --- a/gradle/jdks/21/linux-glibc/x86-64/local-path +++ /dev/null @@ -1 +0,0 @@ -amazon-corretto-21.0.5.11.1 diff --git a/gradle/jdks/21/linux-musl/aarch64/download-url b/gradle/jdks/21/linux-musl/aarch64/download-url deleted file mode 100644 index 90d966e8..00000000 --- a/gradle/jdks/21/linux-musl/aarch64/download-url +++ /dev/null @@ -1 +0,0 @@ -https://corretto.aws/downloads/resources/21.0.5.11.1/amazon-corretto-21.0.5.11.1-alpine-linux-aarch64.tar.gz diff --git a/gradle/jdks/21/linux-musl/aarch64/local-path b/gradle/jdks/21/linux-musl/aarch64/local-path deleted file mode 100644 index 4c19e3ac..00000000 --- a/gradle/jdks/21/linux-musl/aarch64/local-path +++ /dev/null @@ -1 +0,0 @@ -amazon-corretto-21.0.5.11.1 diff --git a/gradle/jdks/21/linux-musl/x86-64/download-url b/gradle/jdks/21/linux-musl/x86-64/download-url deleted file mode 100644 index a507d2cd..00000000 --- a/gradle/jdks/21/linux-musl/x86-64/download-url +++ /dev/null @@ -1 +0,0 @@ -https://corretto.aws/downloads/resources/21.0.5.11.1/amazon-corretto-21.0.5.11.1-alpine-linux-x64.tar.gz diff --git a/gradle/jdks/21/linux-musl/x86-64/local-path b/gradle/jdks/21/linux-musl/x86-64/local-path deleted file mode 100644 index 4c19e3ac..00000000 --- a/gradle/jdks/21/linux-musl/x86-64/local-path +++ /dev/null @@ -1 +0,0 @@ -amazon-corretto-21.0.5.11.1 diff --git a/gradle/jdks/21/macos/aarch64/download-url b/gradle/jdks/21/macos/aarch64/download-url deleted file mode 100644 index 2ab7620e..00000000 --- a/gradle/jdks/21/macos/aarch64/download-url +++ /dev/null @@ -1 +0,0 @@ -https://corretto.aws/downloads/resources/21.0.5.11.1/amazon-corretto-21.0.5.11.1-macosx-aarch64.tar.gz diff --git a/gradle/jdks/21/macos/aarch64/local-path b/gradle/jdks/21/macos/aarch64/local-path deleted file mode 100644 index 4c19e3ac..00000000 --- a/gradle/jdks/21/macos/aarch64/local-path +++ /dev/null @@ -1 +0,0 @@ -amazon-corretto-21.0.5.11.1 diff --git a/gradle/jdks/21/macos/x86-64/download-url b/gradle/jdks/21/macos/x86-64/download-url deleted file mode 100644 index 376401ed..00000000 --- a/gradle/jdks/21/macos/x86-64/download-url +++ /dev/null @@ -1 +0,0 @@ -https://corretto.aws/downloads/resources/21.0.5.11.1/amazon-corretto-21.0.5.11.1-macosx-x64.tar.gz diff --git a/gradle/jdks/21/macos/x86-64/local-path b/gradle/jdks/21/macos/x86-64/local-path deleted file mode 100644 index 4c19e3ac..00000000 --- a/gradle/jdks/21/macos/x86-64/local-path +++ /dev/null @@ -1 +0,0 @@ -amazon-corretto-21.0.5.11.1 diff --git a/gradle/jdks/21/windows/x86-64/download-url b/gradle/jdks/21/windows/x86-64/download-url deleted file mode 100644 index 3f033748..00000000 --- a/gradle/jdks/21/windows/x86-64/download-url +++ /dev/null @@ -1 +0,0 @@ -https://corretto.aws/downloads/resources/21.0.5.11.1/amazon-corretto-21.0.5.11.1-windows-x64-jdk.zip diff --git a/gradle/jdks/21/windows/x86-64/local-path b/gradle/jdks/21/windows/x86-64/local-path deleted file mode 100644 index 4c19e3ac..00000000 --- a/gradle/jdks/21/windows/x86-64/local-path +++ /dev/null @@ -1 +0,0 @@ -amazon-corretto-21.0.5.11.1 From 374e740ba4eb4bf085265ba2bfa9a980d3dde4ff Mon Sep 17 00:00:00 2001 From: Claudia Rogoz Date: Mon, 25 Nov 2024 15:05:31 +0100 Subject: [PATCH 09/14] option --- build.gradle | 2 +- .../com/palantir/gradle/jdks/GradleJdksConfigs.java | 2 +- .../gradle/jdks/JdkDistributionConfigurator.java | 10 ++++++++-- .../com/palantir/gradle/jdks/ToolchainsPlugin.java | 2 +- gradle/jdks/21/linux-glibc/aarch64/download-url | 1 + gradle/jdks/21/linux-glibc/aarch64/local-path | 1 + gradle/jdks/21/linux-glibc/x86-64/download-url | 1 + gradle/jdks/21/linux-glibc/x86-64/local-path | 1 + gradle/jdks/21/linux-musl/aarch64/download-url | 1 + gradle/jdks/21/linux-musl/aarch64/local-path | 1 + gradle/jdks/21/linux-musl/x86-64/download-url | 1 + gradle/jdks/21/linux-musl/x86-64/local-path | 1 + gradle/jdks/21/macos/aarch64/download-url | 1 + gradle/jdks/21/macos/aarch64/local-path | 1 + gradle/jdks/21/macos/x86-64/download-url | 1 + gradle/jdks/21/macos/x86-64/local-path | 1 + gradle/jdks/21/windows/x86-64/download-url | 1 + gradle/jdks/21/windows/x86-64/local-path | 1 + 18 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 gradle/jdks/21/linux-glibc/aarch64/download-url create mode 100644 gradle/jdks/21/linux-glibc/aarch64/local-path create mode 100644 gradle/jdks/21/linux-glibc/x86-64/download-url create mode 100644 gradle/jdks/21/linux-glibc/x86-64/local-path create mode 100644 gradle/jdks/21/linux-musl/aarch64/download-url create mode 100644 gradle/jdks/21/linux-musl/aarch64/local-path create mode 100644 gradle/jdks/21/linux-musl/x86-64/download-url create mode 100644 gradle/jdks/21/linux-musl/x86-64/local-path create mode 100644 gradle/jdks/21/macos/aarch64/download-url create mode 100644 gradle/jdks/21/macos/aarch64/local-path create mode 100644 gradle/jdks/21/macos/x86-64/download-url create mode 100644 gradle/jdks/21/macos/x86-64/local-path create mode 100644 gradle/jdks/21/windows/x86-64/download-url create mode 100644 gradle/jdks/21/windows/x86-64/local-path diff --git a/build.gradle b/build.gradle index 927c37de..d82e7dfd 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { dependencies { classpath 'com.palantir.gradle.failure-reports:gradle-failure-reports:1.13.0' classpath 'com.palantir.jakartapackagealignment:jakarta-package-alignment:0.6.0' - classpath 'com.palantir.gradle.jdks:gradle-jdks:0.57.0-13-g25ce299' + classpath 'com.palantir.gradle.jdks:gradle-jdks:0.57.0-14-g2d592ff.dirty' classpath 'com.palantir.gradle.jdkslatest:gradle-jdks-latest:0.16.0' classpath 'org.unbroken-dome.gradle-plugins:gradle-testsets-plugin:4.1.0' classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.19.0' diff --git a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/GradleJdksConfigs.java b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/GradleJdksConfigs.java index 3f82a0b1..8190e6d9 100644 --- a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/GradleJdksConfigs.java +++ b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/GradleJdksConfigs.java @@ -52,7 +52,7 @@ public abstract class GradleJdksConfigs extends DefaultTask { @Option( option = "includeJava", description = "Generates the jdk configuration directories for the Java major version.") - public abstract SetProperty getIncludedJavaMajorVersion(); + public abstract SetProperty getIncludedJavaMajorVersion(); @Nested public abstract MapProperty> getJavaVersionToJdkDistros(); diff --git a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdkDistributionConfigurator.java b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdkDistributionConfigurator.java index 89f5c801..b4125fb1 100644 --- a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdkDistributionConfigurator.java +++ b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdkDistributionConfigurator.java @@ -28,6 +28,7 @@ import org.gradle.api.Project; import org.gradle.api.logging.Logger; import org.gradle.api.logging.Logging; +import org.gradle.api.provider.SetProperty; import org.gradle.jvm.toolchain.JavaLanguageVersion; public final class JdkDistributionConfigurator { @@ -36,8 +37,13 @@ public final class JdkDistributionConfigurator { private static final JavaLanguageVersion MINIMUM_SUPPORTED_JAVA_VERSION = JavaLanguageVersion.of(11); public static Map> getJavaVersionToJdkDistros( - Project project, JdkDistributions jdkDistributions, JdksExtension jdksExtension) { - Set javaVersions = jdksExtension.getJdkMajorVersionsToUse().get().stream() + Project project, + JdkDistributions jdkDistributions, + JdksExtension jdksExtension, + SetProperty extraLanguageVersions) { + Set javaVersions = Stream.concat( + jdksExtension.getJdkMajorVersionsToUse().get().stream(), + extraLanguageVersions.get().stream().map(JavaLanguageVersion::of)) .filter(javaLanguageVersion -> javaLanguageVersion.canCompileOrRun(MINIMUM_SUPPORTED_JAVA_VERSION)) .collect(Collectors.toSet()); return javaVersions.stream() diff --git a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/ToolchainsPlugin.java b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/ToolchainsPlugin.java index 05f4d1fd..fba89c05 100644 --- a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/ToolchainsPlugin.java +++ b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/ToolchainsPlugin.java @@ -114,7 +114,7 @@ public void apply(Project rootProject) { task.getDaemonJavaVersion().set(jdksExtension.getDaemonTarget()); task.getJavaVersionToJdkDistros() .putAll(rootProject.provider(() -> JdkDistributionConfigurator.getJavaVersionToJdkDistros( - rootProject, jdkDistributions, jdksExtension))); + rootProject, jdkDistributions, jdksExtension, task.getIncludedJavaMajorVersion()))); task.getCaCerts().putAll(jdksExtension.getCaCerts()); }); diff --git a/gradle/jdks/21/linux-glibc/aarch64/download-url b/gradle/jdks/21/linux-glibc/aarch64/download-url new file mode 100644 index 00000000..43106141 --- /dev/null +++ b/gradle/jdks/21/linux-glibc/aarch64/download-url @@ -0,0 +1 @@ +https://corretto.aws/downloads/resources/21.0.5.11.1/amazon-corretto-21.0.5.11.1-linux-aarch64.tar.gz diff --git a/gradle/jdks/21/linux-glibc/aarch64/local-path b/gradle/jdks/21/linux-glibc/aarch64/local-path new file mode 100644 index 00000000..4c19e3ac --- /dev/null +++ b/gradle/jdks/21/linux-glibc/aarch64/local-path @@ -0,0 +1 @@ +amazon-corretto-21.0.5.11.1 diff --git a/gradle/jdks/21/linux-glibc/x86-64/download-url b/gradle/jdks/21/linux-glibc/x86-64/download-url new file mode 100644 index 00000000..25c31a53 --- /dev/null +++ b/gradle/jdks/21/linux-glibc/x86-64/download-url @@ -0,0 +1 @@ +https://corretto.aws/downloads/resources/21.0.5.11.1/amazon-corretto-21.0.5.11.1-linux-x64.tar.gz diff --git a/gradle/jdks/21/linux-glibc/x86-64/local-path b/gradle/jdks/21/linux-glibc/x86-64/local-path new file mode 100644 index 00000000..4c19e3ac --- /dev/null +++ b/gradle/jdks/21/linux-glibc/x86-64/local-path @@ -0,0 +1 @@ +amazon-corretto-21.0.5.11.1 diff --git a/gradle/jdks/21/linux-musl/aarch64/download-url b/gradle/jdks/21/linux-musl/aarch64/download-url new file mode 100644 index 00000000..90d966e8 --- /dev/null +++ b/gradle/jdks/21/linux-musl/aarch64/download-url @@ -0,0 +1 @@ +https://corretto.aws/downloads/resources/21.0.5.11.1/amazon-corretto-21.0.5.11.1-alpine-linux-aarch64.tar.gz diff --git a/gradle/jdks/21/linux-musl/aarch64/local-path b/gradle/jdks/21/linux-musl/aarch64/local-path new file mode 100644 index 00000000..4c19e3ac --- /dev/null +++ b/gradle/jdks/21/linux-musl/aarch64/local-path @@ -0,0 +1 @@ +amazon-corretto-21.0.5.11.1 diff --git a/gradle/jdks/21/linux-musl/x86-64/download-url b/gradle/jdks/21/linux-musl/x86-64/download-url new file mode 100644 index 00000000..a507d2cd --- /dev/null +++ b/gradle/jdks/21/linux-musl/x86-64/download-url @@ -0,0 +1 @@ +https://corretto.aws/downloads/resources/21.0.5.11.1/amazon-corretto-21.0.5.11.1-alpine-linux-x64.tar.gz diff --git a/gradle/jdks/21/linux-musl/x86-64/local-path b/gradle/jdks/21/linux-musl/x86-64/local-path new file mode 100644 index 00000000..4c19e3ac --- /dev/null +++ b/gradle/jdks/21/linux-musl/x86-64/local-path @@ -0,0 +1 @@ +amazon-corretto-21.0.5.11.1 diff --git a/gradle/jdks/21/macos/aarch64/download-url b/gradle/jdks/21/macos/aarch64/download-url new file mode 100644 index 00000000..2ab7620e --- /dev/null +++ b/gradle/jdks/21/macos/aarch64/download-url @@ -0,0 +1 @@ +https://corretto.aws/downloads/resources/21.0.5.11.1/amazon-corretto-21.0.5.11.1-macosx-aarch64.tar.gz diff --git a/gradle/jdks/21/macos/aarch64/local-path b/gradle/jdks/21/macos/aarch64/local-path new file mode 100644 index 00000000..4c19e3ac --- /dev/null +++ b/gradle/jdks/21/macos/aarch64/local-path @@ -0,0 +1 @@ +amazon-corretto-21.0.5.11.1 diff --git a/gradle/jdks/21/macos/x86-64/download-url b/gradle/jdks/21/macos/x86-64/download-url new file mode 100644 index 00000000..376401ed --- /dev/null +++ b/gradle/jdks/21/macos/x86-64/download-url @@ -0,0 +1 @@ +https://corretto.aws/downloads/resources/21.0.5.11.1/amazon-corretto-21.0.5.11.1-macosx-x64.tar.gz diff --git a/gradle/jdks/21/macos/x86-64/local-path b/gradle/jdks/21/macos/x86-64/local-path new file mode 100644 index 00000000..4c19e3ac --- /dev/null +++ b/gradle/jdks/21/macos/x86-64/local-path @@ -0,0 +1 @@ +amazon-corretto-21.0.5.11.1 diff --git a/gradle/jdks/21/windows/x86-64/download-url b/gradle/jdks/21/windows/x86-64/download-url new file mode 100644 index 00000000..3f033748 --- /dev/null +++ b/gradle/jdks/21/windows/x86-64/download-url @@ -0,0 +1 @@ +https://corretto.aws/downloads/resources/21.0.5.11.1/amazon-corretto-21.0.5.11.1-windows-x64-jdk.zip diff --git a/gradle/jdks/21/windows/x86-64/local-path b/gradle/jdks/21/windows/x86-64/local-path new file mode 100644 index 00000000..4c19e3ac --- /dev/null +++ b/gradle/jdks/21/windows/x86-64/local-path @@ -0,0 +1 @@ +amazon-corretto-21.0.5.11.1 From 3eabf8cedf2e589a95a7e78f5e42e4bde1e27b05 Mon Sep 17 00:00:00 2001 From: Claudia Rogoz Date: Mon, 25 Nov 2024 15:07:53 +0100 Subject: [PATCH 10/14] old gradle-jdks --- build.gradle | 4 +--- gradle/gradle-jdks-setup.jar | Bin 112070 -> 112072 bytes 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index d82e7dfd..00ca5ca3 100644 --- a/build.gradle +++ b/build.gradle @@ -2,13 +2,12 @@ buildscript { repositories { mavenCentral() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } } gradlePluginPortal() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } } - mavenLocal() } dependencies { classpath 'com.palantir.gradle.failure-reports:gradle-failure-reports:1.13.0' classpath 'com.palantir.jakartapackagealignment:jakarta-package-alignment:0.6.0' - classpath 'com.palantir.gradle.jdks:gradle-jdks:0.57.0-14-g2d592ff.dirty' + classpath 'com.palantir.gradle.jdks:gradle-jdks:0.57.0' classpath 'com.palantir.gradle.jdkslatest:gradle-jdks-latest:0.16.0' classpath 'org.unbroken-dome.gradle-plugins:gradle-testsets-plugin:4.1.0' classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.19.0' @@ -43,7 +42,6 @@ allprojects { repositories { mavenCentral() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } } gradlePluginPortal() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } } - mavenLocal() } group 'com.palantir.gradle.jdks' diff --git a/gradle/gradle-jdks-setup.jar b/gradle/gradle-jdks-setup.jar index 0cd1840ece6866015f4c1ca20264d44786ea0163..17ce8d02d35930d45f284e970fbcda34d0d18bb4 100644 GIT binary patch delta 7597 zcmY*-bzBwO_cn7tx}~L&I)pSx2`V56(k0#9DRl&C>7xuS-G}aO5CKW)?vPLcLB#hU z_kMr(oqzUvp0)O>9iN%$+eaVRN3U4AgU5JZEJ_In1%>(^3d%#!L>yp*$B|-!A7TJv zI4e3H3?CAR#uQXS>}s{CaaWw4IjKrM4uu!GXYQ52IlHK9Wrd|t(t2QF_caS)ee_1l z_q79qlwe(LUF})Tx&K^qt(Sx5CCrH>bjI0*2407y0}5`^)%MnG)C519sSbld6}bV z>38c&3{OuiNu5+( z2Fy>blb8cMd_L1H@lXt2JwI$d9zKi3kI2m9ZjxIrkxTILVXGSEGm{l+W(S}3;gulT zj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Xb=a;0gYg693TsT;4u0F^5HH@QIijph(|{y(LiHGF!vg}USk#1mBO0b5Xj3`E`#6=zEYk|dzb9@m%^w7SOihTvfWAPROQ0D=HMc#r@%LikMnYO#rc z1SHuM6iNaF!JmnMIB*vfOafpKX=`)#Xp=Fbk0Nv2ygj^LqTnHXTZZu^rDQme-}w-0iqC&j%%KjjV?Sh3w>tr z&VRTpglyy=h>fxw!3N8+(A_l}BO&;I$E7m%uSe_{1xSB=UPsyJU4o|nW55IFGXV1rFg6%ofNtrR<3B-ozmtPaY3Smx3jrFy0Awx%tRdp3sPQvC)brDuAWjL| z_Tk!A3$7LdwvhK1XqzC4_!0+vR)pTr;rBHM=ZerB-@gGOiUD3!)o)Btp%^_nHlSNE zdTe*W@nZDde~W!><^+FXqh|`8EeU9f1N`?&tAlYRz(dGy+-pBpP!SL9M_-EGq?G`K zRiNjQh!7wE!>$$dO#D%{O3}3_-?}E^pne%T2_nkBq^%54ffUmIB^R^+-rqXK=z;(C zlAZpqgD*Wm3GSDoa~di~ALb**zcNDwpagh=))jyU#Fz7069e%p(Oar=UlU$1nj0Vj z!$9=9kjg(z%B}<~fsmvs;1PsQ_-`E+!srLrAD>k5|F7N%aI6a59z#&58juGFLAPr3 zK(9!Fh-!ctWRwQTL7WEg%UQcllRg`g6U&7j@{8v;F?cD}Lxq2J6tlO8oySTmAsqwL$_) v*8?;d<$(Y=6bMj*ZuI~U#%eH-6aqjg^t7 Date: Mon, 25 Nov 2024 16:34:09 +0100 Subject: [PATCH 11/14] libraryTarget first --- .../gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy index 0dd5ad0c..734abb35 100644 --- a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy +++ b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy @@ -250,7 +250,7 @@ class GradleJdkToolchainsIntegrationTest extends GradleJdkIntegrationSpec { buildFile << ''' javaVersions { - distributionTarget = '15' + libraryTarget = 15 } '''.stripIndent(true) writeHelloWorld(projectDir) From 72999fe2ba149f7a4f473692d0c7ec7a0334483b Mon Sep 17 00:00:00 2001 From: Claudia Rogoz Date: Tue, 26 Nov 2024 09:49:25 +0100 Subject: [PATCH 12/14] . --- .../GradleJdkToolchainsIntegrationTest.groovy | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy index 64432b9b..4ee90ae9 100644 --- a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy +++ b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy @@ -246,33 +246,6 @@ class GradleJdkToolchainsIntegrationTest extends GradleJdkIntegrationSpec { gradleVersionNumber << GRADLE_TEST_VERSIONS } - - def '#gradleVersionNumber: only generates daemon jdk'() { - gradleVersion = gradleVersionNumber - setupJdksHardcodedVersions('11') - applyBaselineJavaVersions() - applyApplicationPlugin() - - // language=groovy - buildFile << """ - jdks { - daemonJdkOnly() - } - """.stripIndent(true) - - file('gradle.properties') << 'palantir.jdk.setup.enabled=true' - file('src/main/java/Main.java') << java17PreviewCode - - when: - runTasksSuccessfully('wrapper') - - then: 'only jdk 11 is generated' - Files.list(projectDir.toPath().resolve("gradle/jdks")).allMatch { it -> it.endsWith("gradle/jdks/11")} - - where: - gradleVersionNumber << GRADLE_TEST_VERSIONS - } - def '#gradleVersionNumber: fails if the jdk version is not configured'() { setupJdksHardcodedVersions() applyBaselineJavaVersions() From 2d2bf0e5d6edbb09fa8ce5fb10702cdd74e985a3 Mon Sep 17 00:00:00 2001 From: Claudia Rogoz Date: Mon, 9 Dec 2024 13:43:49 +0100 Subject: [PATCH 13/14] multiple targets --- .../gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy index 4ee90ae9..612df063 100644 --- a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy +++ b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy @@ -231,7 +231,8 @@ class GradleJdkToolchainsIntegrationTest extends GradleJdkIntegrationSpec { def subprojectLib21 = addSubproject 'subproject-lib-21', ''' apply plugin: 'java-library' javaVersion { - target = 21 + target = 17 + runtime = 21 } '''.stripIndent(true) writeJavaSourceFile(getMainJavaCode(), subprojectLib21) From 92baa2022b1b0f6c47385b7d910f041bc45c9e4b Mon Sep 17 00:00:00 2001 From: Claudia Rogoz Date: Wed, 11 Dec 2024 14:15:15 +0100 Subject: [PATCH 14/14] tests --- gradle-jdks-setup/README.md | 20 +++++- .../gradle/jdks/GradleJdksConfigs.java | 11 ++-- .../jdks/JdkDistributionConfigurator.java | 14 ++-- .../palantir/gradle/jdks/JdksExtension.java | 7 +- .../gradle/jdks/ToolchainsPlugin.java | 9 ++- .../GradleJdkToolchainsIntegrationTest.groovy | 66 +++++++++++++++++++ 6 files changed, 108 insertions(+), 19 deletions(-) diff --git a/gradle-jdks-setup/README.md b/gradle-jdks-setup/README.md index 286ddabb..ace324a7 100644 --- a/gradle-jdks-setup/README.md +++ b/gradle-jdks-setup/README.md @@ -90,7 +90,7 @@ jdks { jdks { daemonTarget = daemonJdkOnly() # optional, only installs & configures the daemon JDK version - jdkVersionsToUse = [11, 17, 21, 23] # optional, the set of java versions to install, by default it will contain all the major versions configured in step 3. + jdkMajorVersionsToUse = [11, 17, 21, 23] # optional, the set of java versions to install, by default it will contain all the major versions configured in step 3. } ``` 5. Enable the jdk setup by adding the following to `gradle.properties`: @@ -211,6 +211,24 @@ The plugin registers the following tasks: - `checkGradleJdkConfigs` - checks that all the `gradle/` configurations are up-to-date. E.g. if the `jdks-latest` plugin is updated, we need to make sure the `gradle/jdks` files reflect the jdk versions. - `setupJdks` - task that triggers `wrapperJdkPatcher` and `generateGradleJdkConfigs` and runs the patched `./gradlew` script. + +## Using a new java version + +We are only generating the jdk configuration files for the jdk versions that are used see: [jdkMajorVersionsToUse](https://github.com/palantir/gradle-jdks/blob/26d54605b7827b232024ec7e0c34a87983804492/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java#L44) +Using a new java version is a 2-step process: +1. Firstly, we need to generate the gradle jdk configuration files for the new java version that we are going to use +2. Secondly, once the new files are generated, the javaVersion can be configured in the gradle build configuration. + +### Palantir specific, if using `baseline-java-version` through excavators +1. Run `./gradlew generateGradleJdkConfigs --includeAllJdks`. The command will generate the Gradle jdk configuration files for all jdks. +2. Update the javaVersion(s)/jdks extension values with the desired java major version. +3. Run `./gradlew setupJdks` to only keep the Gradle jdk configuration files for the used Gradle JDKs. + +### Gradle Toolchains workflow +1. Update `jdkMajorVersionsToUse` with the required jdk versions +2. Run `./gradlew setupJdks` + + ## Unsupported - This workflow is disabled on `Windows` at the moment. diff --git a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/GradleJdksConfigs.java b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/GradleJdksConfigs.java index 8190e6d9..0b0ac97f 100644 --- a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/GradleJdksConfigs.java +++ b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/GradleJdksConfigs.java @@ -27,7 +27,6 @@ import org.gradle.api.file.Directory; import org.gradle.api.provider.MapProperty; import org.gradle.api.provider.Property; -import org.gradle.api.provider.SetProperty; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.Nested; import org.gradle.api.tasks.TaskAction; @@ -50,9 +49,9 @@ public abstract class GradleJdksConfigs extends DefaultTask { */ @Input @Option( - option = "includeJava", - description = "Generates the jdk configuration directories for the Java major version.") - public abstract SetProperty getIncludedJavaMajorVersion(); + option = "includeAllJdks", + description = "Generates the configuration directories for all configured Java major versions.") + public abstract Property getIncludeAllJdks(); @Nested public abstract MapProperty> getJavaVersionToJdkDistros(); @@ -76,6 +75,10 @@ protected abstract void applyGradleJdkFileAction( protected abstract void maybePrepareForAction(List targetPaths); + public GradleJdksConfigs() { + getIncludeAllJdks().convention(false); + } + @TaskAction public final void action() { Path gradleJdksDir = gradleDirectory().dir("jdks").getAsFile().toPath(); diff --git a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdkDistributionConfigurator.java b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdkDistributionConfigurator.java index b4125fb1..d8349c99 100644 --- a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdkDistributionConfigurator.java +++ b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdkDistributionConfigurator.java @@ -25,10 +25,10 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.gradle.api.JavaVersion; import org.gradle.api.Project; import org.gradle.api.logging.Logger; import org.gradle.api.logging.Logging; -import org.gradle.api.provider.SetProperty; import org.gradle.jvm.toolchain.JavaLanguageVersion; public final class JdkDistributionConfigurator { @@ -37,13 +37,11 @@ public final class JdkDistributionConfigurator { private static final JavaLanguageVersion MINIMUM_SUPPORTED_JAVA_VERSION = JavaLanguageVersion.of(11); public static Map> getJavaVersionToJdkDistros( - Project project, - JdkDistributions jdkDistributions, - JdksExtension jdksExtension, - SetProperty extraLanguageVersions) { - Set javaVersions = Stream.concat( - jdksExtension.getJdkMajorVersionsToUse().get().stream(), - extraLanguageVersions.get().stream().map(JavaLanguageVersion::of)) + Project project, JdkDistributions jdkDistributions, JdksExtension jdksExtension, Boolean includeAllJdks) { + Set javaVersions = (includeAllJdks + ? Arrays.stream(JavaVersion.values()) + .map(javaVersion -> JavaLanguageVersion.of(javaVersion.getMajorVersion())) + : jdksExtension.jdkMajorVersionsToUse().get().stream()) .filter(javaLanguageVersion -> javaLanguageVersion.canCompileOrRun(MINIMUM_SUPPORTED_JAVA_VERSION)) .collect(Collectors.toSet()); return javaVersions.stream() diff --git a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java index ca8a42fe..62f248ac 100644 --- a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java +++ b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/JdksExtension.java @@ -84,12 +84,13 @@ public final void setDaemonTarget(int value) { getDaemonTarget().set(JavaLanguageVersion.of(value)); } - public final SetProperty getJdkMajorVersionsToUse() { + public final SetProperty jdkMajorVersionsToUse() { return this.jdkMajorVersionsToUse; } - public final void setJdkMajorVersionsToUse(Set javaLanguageVersions) { - this.jdkMajorVersionsToUse.set(javaLanguageVersions); + public final void setJdkMajorVersionsToUse(Set jdkMajorVersions) { + jdkMajorVersionsToUse() + .set(jdkMajorVersions.stream().map(JavaLanguageVersion::of).collect(Collectors.toSet())); } public final void daemonJdkOnly() { diff --git a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/ToolchainsPlugin.java b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/ToolchainsPlugin.java index fba89c05..048b93a2 100644 --- a/gradle-jdks/src/main/java/com/palantir/gradle/jdks/ToolchainsPlugin.java +++ b/gradle-jdks/src/main/java/com/palantir/gradle/jdks/ToolchainsPlugin.java @@ -67,7 +67,7 @@ public void apply(Project rootProject) { rootProject.getExtensions().getByType(BaselineJavaVersionsExtension.class); baselineJavaVersionsExtension.getSetupJdkToolchains().set(false); - jdksExtension.getJdkMajorVersionsToUse().set(rootProject.provider(() -> Stream.of( + jdksExtension.jdkMajorVersionsToUse().set(rootProject.provider(() -> Stream.of( jdksExtension.getDaemonTarget(), baselineJavaVersionsExtension.libraryTarget(), baselineJavaVersionsExtension.runtime().map(ChosenJavaVersion::javaLanguageVersion), @@ -83,7 +83,7 @@ public void apply(Project rootProject) { BaselineJavaVersionExtension projectVersions = proj.getExtensions().getByType(BaselineJavaVersionExtension.class); - jdksExtension.getJdkMajorVersionsToUse().addAll(rootProject.provider(() -> Stream.of( + jdksExtension.jdkMajorVersionsToUse().addAll(rootProject.provider(() -> Stream.of( projectVersions.target(), projectVersions.runtime()) .map(Provider::get) .map(ChosenJavaVersion::javaLanguageVersion) @@ -114,7 +114,10 @@ public void apply(Project rootProject) { task.getDaemonJavaVersion().set(jdksExtension.getDaemonTarget()); task.getJavaVersionToJdkDistros() .putAll(rootProject.provider(() -> JdkDistributionConfigurator.getJavaVersionToJdkDistros( - rootProject, jdkDistributions, jdksExtension, task.getIncludedJavaMajorVersion()))); + rootProject, + jdkDistributions, + jdksExtension, + task.getIncludeAllJdks().get()))); task.getCaCerts().putAll(jdksExtension.getCaCerts()); }); diff --git a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy index 612df063..3b7d8ec5 100644 --- a/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy +++ b/gradle-jdks/src/test/groovy/com/palantir/gradle/jdks/GradleJdkToolchainsIntegrationTest.groovy @@ -209,6 +209,72 @@ class GradleJdkToolchainsIntegrationTest extends GradleJdkIntegrationSpec { where: gradleVersionNumber << GRADLE_TEST_VERSIONS + + } + + def '#gradleVersionNumber: can bump java major version when baseline-java is applied'() { + gradleVersion = gradleVersionNumber + setupJdksHardcodedVersions('11') + applyBaselineJavaVersions() + applyApplicationPlugin() + + // language=groovy + buildFile << """ + javaVersions { + libraryTarget = '11' + } + """.stripIndent(true) + + file('gradle.properties') << 'palantir.jdk.setup.enabled=true' + file('src/main/java/Main.java') << java17PreviewCode + runTasksSuccessfully('wrapper') + + when: + runTasksSuccessfully('generateGradleJdkConfigs', '--includeAllJdks') + + then: 'generates directories for all jdk versions' + Files.list(projectDir.toPath().resolve("gradle/jdks")) + .map { it -> it.getFileName().toString() } + .collect(Collectors.toList()) + .containsAll(List.of("11", "17", "21")) + + when: + runTasksSuccessfully('setupJdks') + + then: 'only jdk 11 is generated' + Files.list(projectDir.toPath().resolve("gradle/jdks")) + .allMatch { it -> it.endsWith("gradle/jdks/11")} + + where: + gradleVersionNumber << GRADLE_TEST_VERSIONS + } + + def '#gradleVersionNumber: only jdkVersionsToUse jdks are generated'() { + gradleVersion = gradleVersionNumber + setupJdksHardcodedVersions('11') + applyApplicationPlugin() + + file('gradle.properties') << 'palantir.jdk.setup.enabled=true' + file('src/main/java/Main.java') << java17PreviewCode + runTasksSuccessfully('wrapper') + + when: + buildFile << """ + jdks { + jdkMajorVersionsToUse = ["11", "21"] + } + """.stripIndent(true) + + runTasksSuccessfully('setupJdks') + + then: 'only jdkVersionsToUse files are generated' + Files.list(projectDir.toPath().resolve("gradle/jdks")) + .map { it -> it.getFileName().toString() } + .collect(Collectors.toList()) + .containsAll(List.of("11", "21")) + + where: + gradleVersionNumber << GRADLE_TEST_VERSIONS } def '#gradleVersionNumber: only required java versions are configured'() {