From 4dd2527ab01154e2fca74a546a94f6584f35246c Mon Sep 17 00:00:00 2001 From: Paolo Di Tommaso Date: Wed, 4 Sep 2024 14:22:47 +0200 Subject: [PATCH] Upgrade gradle build This commit upgrades the gradle build so that - Java 21 is used in the build chain - Upgrade graalvm plugin - Use Oracle as Java vendor - Add toolchain resolver to automatically download requires Java runtime - Bump Gradle 8.10 Signed-off-by: Paolo Di Tommaso --- build.gradle | 13 ++++++++++--- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 7 +++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index e8b6b357..4706ca6d 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ plugins { id 'application' id 'jacoco' id 'org.cadixdev.licenser' version '0.6.1' - id 'org.graalvm.buildtools.native' + id 'org.graalvm.buildtools.native' version '0.10.2' id 'com.github.johnrengelman.shadow' version '7.1.2' } @@ -67,6 +67,12 @@ task buildInfo { } } +java { + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + compileJava { sourceCompatibility = JavaVersion.toVersion("11") targetCompatibility = JavaVersion.toVersion("11") @@ -93,6 +99,7 @@ test { } graalvmNative { + toolchainDetection = true binaries { main { imageName = 'tw' @@ -109,14 +116,14 @@ graalvmNative { buildArgs.add('-H:+ReportExceptionStackTraces') javaLauncher = javaToolchains.launcherFor { - languageVersion = JavaLanguageVersion.of(17) + languageVersion = JavaLanguageVersion.of(21) + vendor = JvmVendorSpec.matching("Oracle Corporation") } } test { verbose = true - agent = false } } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aa991fce..e1adfb49 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index f24ee2fd..ec3c5423 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,4 +17,11 @@ pluginManagement { } } +plugins { + // required to download the toolchain (jdk) from a remote repository + // https://github.com/gradle/foojay-toolchains + // https://docs.gradle.org/current/userguide/toolchains.html#sub:download_repositories + id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" +} + rootProject.name = 'tower-cli'