Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native Image #330

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,38 @@ 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
- uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
- uses: graalvm/setup-graalvm@v1
with:
version: '21.3.0'
java-version: '17'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
set-java-home: false
- run: echo "org.gradle.java.installations.fromEnv=GRAALVM_HOME" >> gradle.properties
- run: sudo apt-get install -y build-essential libz-dev zlib1g-dev
- run: |
echo $LD_LIBRARY_PATH
sudo ldconfig
- uses: gradle/gradle-build-action@v2
with:
arguments: --quiet javaToolchains
- uses: gradle/gradle-build-action@v2
with:
arguments: --stacktrace alpha-cli-app:nativeCompile --exclude-task 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
path: alpha-cli-app/build/native-image/alpha
20 changes: 20 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.graalvm.buildtools.native") version "0.9.8"
}

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

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"))
})
}
}
}
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": []
}
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")