From c64202ca802f3ac56e2c288e45d22d99b8731435 Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Mon, 20 Dec 2021 16:34:44 +0100 Subject: [PATCH] native: Use GraalVM Gradle Plugin --- .github/workflows/build.yml | 6 +++--- alpha-cli-app/build.gradle.kts | 28 ++++++++++++++++++---------- settings.gradle.kts | 9 ++++++++- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 88b597a91..3cbca7e3a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -78,9 +78,9 @@ jobs: - run: gu install native-image - uses: gradle/gradle-build-action@v2 with: - arguments: build --stacktrace alpha-cli-app:nativeImage -x test - - run: ./alpha-cli-app/build/native-image/alpha --help - - run: ./alpha-cli-app/build/native-image/alpha -str 'a.' + arguments: build --stacktrace alpha-cli-app:nativeCompile -x test + - run: ./alpha-cli-app/build/native/nativeCompile/alpha --help + - run: ./alpha-cli-app/build/native/nativeCompile/alpha -str 'a.' - uses: actions/upload-artifact@v2 with: name: alpha diff --git a/alpha-cli-app/build.gradle.kts b/alpha-cli-app/build.gradle.kts index 633d5cdf5..e68b7dd90 100644 --- a/alpha-cli-app/build.gradle.kts +++ b/alpha-cli-app/build.gradle.kts @@ -1,6 +1,6 @@ plugins { id("alpha.java-application-conventions") - id("org.mikeneck.graalvm-native-image") version "1.4.1" + id("org.graalvm.buildtools.native") version "0.9.8" } dependencies { @@ -73,13 +73,21 @@ tasks.test { useJUnitPlatform() } -tasks.nativeImage { - mainClass = main - executableName = "alpha" - arguments( - "--no-fallback", - "-H:Log=registerResource", - "-H:+ReportExceptionStackTraces", - "--report-unsupported-elements-at-runtime", - ) +graalvmNative { + binaries { + named("main") { + imageName.set("alpha") + mainClass.set(main) + buildArgs.addAll( + "--no-fallback", + "-H:Log=registerResource", + "-H:+ReportExceptionStackTraces", + "--report-unsupported-elements-at-runtime" + ) + javaLauncher.set(javaToolchains.launcherFor { + languageVersion.set(JavaLanguageVersion.of(17)) + vendor.set(JvmVendorSpec.matching("GraalVM")) + }) + } + } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 28bf10ac3..4ffa44b28 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,2 +1,9 @@ +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + } +} + rootProject.name = "alpha" -include("alpha-api", "alpha-cli-app", "alpha-core", "alpha-solver", "alpha-commons") \ No newline at end of file +include("alpha-api", "alpha-cli-app", "alpha-core", "alpha-solver", "alpha-commons")