From 6b1bc044434043e37448ecd77d04aaf32d8d1b2b Mon Sep 17 00:00:00 2001 From: Serhii Prodan <22973227+serpro69@users.noreply.github.com> Date: Sun, 10 Mar 2024 17:11:18 +0100 Subject: [PATCH] Set javaToolchain for cli-bot:nativeCompile --- .github/workflows/build.yml | 6 ++++-- .github/workflows/publish_snapshot.yml | 4 +--- build.gradle.kts | 2 ++ cli-bot/build.gradle.kts | 13 ++++++++++--- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 79c6395e8..015d0284f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -80,9 +80,11 @@ jobs: run: ./gradlew nativeCompile - name: Test native image run: | + _app_path=$(find ./cli-bot/build/native/nativeCompile/ -type f -name faker-bot\* -not -name \*.txt) + mv "$_app_path" $RUNNER_TEMP/faker-bot # run several iterations to test various pathways when generating data for i in {0..10}; do - ./cli-bot/build/native/nativeCompile/faker-bot list --verbose >/dev/null || false - ./cli-bot/build/native/nativeCompile/faker-bot lookup a --verbose >/dev/null || false + ${{ runner.temp }}/faker-bot list --verbose >/dev/null || false + ${{ runner.temp }}/faker-bot lookup a --verbose >/dev/null || false done diff --git a/.github/workflows/publish_snapshot.yml b/.github/workflows/publish_snapshot.yml index d77464c0f..a59e302e6 100644 --- a/.github/workflows/publish_snapshot.yml +++ b/.github/workflows/publish_snapshot.yml @@ -41,9 +41,7 @@ jobs: - name: Set up JDK 8 uses: actions/setup-java@v4 with: - java-version: | - 8 - 17 + java-version: 8 distribution: 'temurin' # loosely based on https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#installing-java-from-local-file - name: Fetch latest graalce JDK diff --git a/build.gradle.kts b/build.gradle.kts index 261144503..29d6cc53a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -73,12 +73,14 @@ subprojects { configure { toolchain { languageVersion = JavaLanguageVersion.of(8) + vendor.set(JvmVendorSpec.matching("Temurin")) } } configure { jvmToolchain { languageVersion.set(JavaLanguageVersion.of(8)) + vendor.set(JvmVendorSpec.matching("Temurin")) } } diff --git a/cli-bot/build.gradle.kts b/cli-bot/build.gradle.kts index c3c22e465..581684c93 100644 --- a/cli-bot/build.gradle.kts +++ b/cli-bot/build.gradle.kts @@ -47,8 +47,10 @@ application { } java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + toolchain { + languageVersion = JavaLanguageVersion.of(8) + vendor.set(JvmVendorSpec.matching("Temurin")) + } } testlogger { @@ -91,7 +93,12 @@ graalvmNative { toolchainDetection = true binaries { named("main") { - imageName = "faker-bot" + imageName = "faker-bot_${project.version}" + javaLauncher = javaToolchains.launcherFor { + languageVersion = JavaLanguageVersion.of(17) + vendor.set(JvmVendorSpec.GRAAL_VM) + } + mainClass.set(mainFunction) } } }