Skip to content

Commit

Permalink
native: Use GraalVM Gradle Plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzleutgeb committed Dec 20, 2021
1 parent b56a9a9 commit c64202c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 18 additions & 10 deletions alpha-cli-app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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"))
})
}
}
}
9 changes: 8 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}

rootProject.name = "alpha"
include("alpha-api", "alpha-cli-app", "alpha-core", "alpha-solver", "alpha-commons")
include("alpha-api", "alpha-cli-app", "alpha-core", "alpha-solver", "alpha-commons")

0 comments on commit c64202c

Please sign in to comment.