Skip to content

Commit

Permalink
adding native image
Browse files Browse the repository at this point in the history
  • Loading branch information
fcaps committed Dec 8, 2023
1 parent c9c4e60 commit fa051cb
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/native-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: GraalVM Native Image builds
on: [push]
jobs:
build:
name: ICE on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4

- uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Log info
run: |
echo "GRAALVM_HOME: $GRAALVM_HOME"
echo "JAVA_HOME: $JAVA_HOME"
java --version
native-image --version
- name: Example step using Gradle plugin # https://graalvm.github.io/native-build-tools/latest/gradle-plugin.html
run: gradlew nativeCompile
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: kia-cli-${{ matrix.os }}
path: kia-cli*
4 changes: 4 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ subprojects {
repositories {
mavenCentral()
maven { setUrl("https://jitpack.io") }
gradlePluginPortal()
}

apply(plugin = "com.adarshr.test-logger")
Expand All @@ -40,4 +41,7 @@ plugins {
id("org.jetbrains.kotlin.plugin.allopen") version kotlinVersion apply false
id("com.diffplug.spotless") version "6.21.0" apply false
id("com.adarshr.test-logger") version "3.2.0" apply false
id("org.graalvm.buildtools.native") version "0.9.28" apply false
}


10 changes: 10 additions & 0 deletions kia-cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
id("org.jetbrains.kotlin.jvm")
id("org.jetbrains.kotlin.kapt")
id("com.github.johnrengelman.shadow") version "8.1.1"
id("org.graalvm.buildtools.native")
}

dependencies {
Expand All @@ -22,6 +23,15 @@ dependencies {
implementation(project(":kia-lib"))
}

graalvmNative {
toolchainDetection.set(true)
binaries {
named("main") {
mainClass.set("com.faforever.ice.KiaApplication")
}
}
}

tasks {
build {
dependsOn(shadowJar)
Expand Down

0 comments on commit fa051cb

Please sign in to comment.