Added GraalVM configuration to create a native binary (#452)

* Initial GraalVM configuration

* graalvm reflection changes for v0.7.4

* graalvm removed unneeded options for native-image

* updated gradle plugin org.mikeneck.graalvm-native-image to 1.1.0

* moved from gradle graalvm-native-image plugin to native-build.sh

* added missing graalvm reflection config for receive

* refactored native-build.sh to a gradle task buildNativeBinary
This commit is contained in:
Michael Kebe 2021-01-23 11:11:50 +01:00 committed by GitHub
parent cb596c15f1
commit a709447536
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 1590 additions and 0 deletions

View file

@ -74,3 +74,39 @@ task checkLibVersions {
}
}
}
task buildNativeBinary {
dependsOn("build")
doLast {
def graalVMHome = System.getenv("GRAALVM_HOME")
if (!graalVMHome) {
throw new GradleException('Required GRAALVM_HOME environment variable not set.')
}
def nativeBinaryOutputPath = "$buildDir/native-image"
def nativeBinaryName = "signal-cli"
mkdir nativeBinaryOutputPath
exec {
workingDir "."
commandLine "$graalVMHome/bin/native-image",
"-H:Path=$nativeBinaryOutputPath",
"-H:Name=$nativeBinaryName",
"-H:JNIConfigurationFiles=",
"-H:DynamicProxyConfigurationFiles=",
"-H:ReflectionConfigurationFiles=",
"-H:ResourceConfigurationFiles=",
"--no-fallback",
"--allow-incomplete-classpath",
"--report-unsupported-elements-at-runtime",
"--enable-url-protocols=http,https",
"--enable-https",
"--enable-all-security-services",
"-H:ResourceConfigurationFiles=graalvm-config-dir/resource-config.json",
"-H:ReflectionConfigurationFiles=graalvm-config-dir/reflect-config.json",
"-cp",
sourceSets.main.runtimeClasspath.asPath,
project.mainClassName
}
}
}