Skip to content

Commit

Permalink
cli: Add Native Image build
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzleutgeb committed Dec 20, 2021
1 parent d42818a commit b56a9a9
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,30 @@ jobs:
- uses: codecov/codecov-action@v1
if: matrix.os == env.MAIN_OS && matrix.java == env.MAIN_JAVA
continue-on-error: true
native-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- name: Set up Graal
run: |
mkdir graalvm
wget -qO- 'https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.3.0/graalvm-ce-java17-linux-amd64-21.3.0.tar.gz' | tar xzf - --strip-components=1 -C graalvm
echo "${PWD}/graalvm/bin" >> $GITHUB_PATH
echo "JAVA_HOME=${PWD}/graalvm" >> $GITHUB_ENV
- run: sudo apt-get install -y build-essential libz-dev zlib1g-dev
- run: |
echo $LD_LIBRARY_PATH
sudo ldconfig
- 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.'
- uses: actions/upload-artifact@v2
with:
name: alpha
path: alpha-cli-app/build/native-image/alpha
12 changes: 12 additions & 0 deletions alpha-cli-app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id("alpha.java-application-conventions")
id("org.mikeneck.graalvm-native-image") version "1.4.1"
}

dependencies {
Expand Down Expand Up @@ -71,3 +72,14 @@ tasks.create<Jar>("bundledJar") {
tasks.test {
useJUnitPlatform()
}

tasks.nativeImage {
mainClass = main
executableName = "alpha"
arguments(
"--no-fallback",
"-H:Log=registerResource",
"-H:+ReportExceptionStackTraces",
"--report-unsupported-elements-at-runtime",
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"resources": {
"includes": [
{
"pattern": "^stringtemplates/aggregate-encodings.stg$"
},
{
"pattern": "^simplelogger.properties$"
}
]
},
"bundles": []
}

0 comments on commit b56a9a9

Please sign in to comment.