mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
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:
parent
cb596c15f1
commit
a709447536
4 changed files with 1590 additions and 0 deletions
14
README.md
14
README.md
|
@ -83,6 +83,20 @@ dependencies. If you have a recent gradle version installed, you can replace `./
|
|||
|
||||
./gradlew distTar
|
||||
|
||||
### Building a native binary with GraalVM
|
||||
|
||||
It is possible to build a native binary with [GraalVM](https://www.graalvm.org).
|
||||
|
||||
1. [Install GraalVM and setup the enviroment](https://www.graalvm.org/docs/getting-started/#install-graalvm)
|
||||
2. [Install prerequisites](https://www.graalvm.org/reference-manual/native-image/#prerequisites)
|
||||
2. Execute Gradle:
|
||||
|
||||
./gradle nativeImage
|
||||
|
||||
The binary is available at
|
||||
|
||||
build/native-image/signal-cli
|
||||
|
||||
## Troubleshooting
|
||||
If you use a version of the Oracle JRE and get an InvalidKeyException you need to enable unlimited strength crypto. See https://stackoverflow.com/questions/6481627/java-security-illegal-key-size-or-default-parameters for instructions.
|
||||
|
||||
|
|
36
build.gradle
36
build.gradle
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
1529
graalvm-config-dir/reflect-config.json
Normal file
1529
graalvm-config-dir/reflect-config.json
Normal file
File diff suppressed because it is too large
Load diff
11
graalvm-config-dir/resource-config.json
Normal file
11
graalvm-config-dir/resource-config.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"resources":{
|
||||
"includes":[
|
||||
{"pattern":"com/google/i18n/phonenumbers/data/.*"},
|
||||
{"pattern":"libzkgroup.so"},
|
||||
{"pattern":"org/asamk/signal/manager/ias.store"},
|
||||
{"pattern":"org/asamk/signal/manager/whisper.store"},
|
||||
{"pattern":"org/slf4j/impl/StaticLoggerBinder.class"}
|
||||
]},
|
||||
"bundles":[{"name":"net.sourceforge.argparse4j.internal.ArgumentParserImpl"}]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue