Skip to content

Commit 2eabb32

Browse files
authored
[Gradle] Autoprovision jvm for gradle daemon (#124071) (#125148)
With Gradle 8.13 we can now auto provision the jdk used by the gradle daemon. Our configuration relies on jdk21. With this autoprovisioning enabled each gradle build will use adoptium jdk 21 for gradle jvm
1 parent 5acedc6 commit 2eabb32

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/toolchain/ArchivedOracleJdkToolchainResolver.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
*/
3030
public abstract class ArchivedOracleJdkToolchainResolver extends AbstractCustomJavaToolchainResolver {
3131

32-
private static final Map<Integer, String> ARCHIVED_BASE_VERSIONS = Maps.of(20, "20.0.2", 19, "19.0.2", 18, "18.0.2.1");
32+
private static final Map<Integer, String> ARCHIVED_BASE_VERSIONS = Maps.of(21, "21.0.6", 20, "20.0.2", 19, "19.0.2", 18, "18.0.2.1");
3333

3434
@Override
3535
public Optional<JavaToolchainDownload> resolve(JavaToolchainRequest request) {

build.gradle

+28
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,34 @@ allprojects {
380380
apply plugin: 'elasticsearch.formatting'
381381
}
382382

383+
tasks.named("updateDaemonJvm") {
384+
def myPlatforms = [
385+
BuildPlatformFactory.of(
386+
org.gradle.platform.Architecture.AARCH64,
387+
org.gradle.platform.OperatingSystem.MAC_OS
388+
),
389+
BuildPlatformFactory.of(
390+
org.gradle.platform.Architecture.AARCH64,
391+
org.gradle.platform.OperatingSystem.LINUX
392+
),
393+
BuildPlatformFactory.of(
394+
org.gradle.platform.Architecture.X86_64,
395+
org.gradle.platform.OperatingSystem.LINUX
396+
),
397+
BuildPlatformFactory.of(
398+
org.gradle.platform.Architecture.X86_64,
399+
org.gradle.platform.OperatingSystem.WINDOWS
400+
),
401+
// anyone still using x86 osx?
402+
BuildPlatformFactory.of(
403+
org.gradle.platform.Architecture.X86_64,
404+
org.gradle.platform.OperatingSystem.MAC_OS
405+
)
406+
]
407+
toolchainPlatforms.set(myPlatforms)
408+
languageVersion = JavaLanguageVersion.of(21)
409+
vendor = JvmVendorSpec.ADOPTIUM
410+
}
383411

384412
tasks.register("verifyBwcTestsEnabled") {
385413
doLast {

gradle/gradle-daemon-jvm.properties

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#This file is generated by updateDaemonJvm
2+
toolchainUrl.LINUX.AARCH64=https\://api.adoptium.net/v3/binary/version/jdk-21.0.6+7/linux/aarch64/jdk/hotspot/normal/eclipse?project\=jdk
3+
toolchainUrl.LINUX.X86_64=https\://api.adoptium.net/v3/binary/version/jdk-21.0.6+7/linux/x64/jdk/hotspot/normal/eclipse?project\=jdk
4+
toolchainUrl.MAC_OS.AARCH64=https\://api.adoptium.net/v3/binary/version/jdk-21.0.6+7/mac/aarch64/jdk/hotspot/normal/eclipse?project\=jdk
5+
toolchainUrl.MAC_OS.X86_64=https\://api.adoptium.net/v3/binary/version/jdk-21.0.6+7/mac/x64/jdk/hotspot/normal/eclipse?project\=jdk
6+
toolchainUrl.WINDOWS.X86_64=https\://api.adoptium.net/v3/binary/version/jdk-21.0.6+7/windows/x64/jdk/hotspot/normal/eclipse?project\=jdk
7+
toolchainVendor=ADOPTIUM
8+
toolchainVersion=21

0 commit comments

Comments
 (0)