mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-28 18:10:38 +00:00
Use official graalvm native-image gradle plugin
This commit is contained in:
parent
cbff7217c1
commit
627a587952
3 changed files with 19 additions and 43 deletions
|
@ -98,9 +98,9 @@ This is still experimental and will not work in all situations.
|
|||
2. [Install prerequisites](https://www.graalvm.org/reference-manual/native-image/#prerequisites)
|
||||
3. Execute Gradle:
|
||||
|
||||
./gradlew assembleNativeImage
|
||||
./gradlew nativeCompile
|
||||
|
||||
The binary is available at *build/native-image/signal-cli*
|
||||
The binary is available at *build/native/nativeCompile/signal-cli*
|
||||
|
||||
## FAQ and Troubleshooting
|
||||
For frequently asked questions and issues have a look at the [wiki](https://github.com/AsamK/signal-cli/wiki/FAQ)
|
||||
|
|
|
@ -3,6 +3,7 @@ plugins {
|
|||
application
|
||||
eclipse
|
||||
`check-lib-versions`
|
||||
id("org.graalvm.buildtools.native") version "0.9.5"
|
||||
}
|
||||
|
||||
version = "0.9.0"
|
||||
|
@ -16,6 +17,15 @@ application {
|
|||
mainClass.set("org.asamk.signal.Main")
|
||||
}
|
||||
|
||||
graalvmNative {
|
||||
binaries {
|
||||
this["main"].run {
|
||||
configurationFileDirectories.from(file("graalvm-config-dir"))
|
||||
buildArgs.add("--allow-incomplete-classpath")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
|
@ -63,42 +73,3 @@ tasks.withType<JavaExec> {
|
|||
args = groovy.util.Eval.me(appArgs) as MutableList<String>
|
||||
}
|
||||
}
|
||||
|
||||
val assembleNativeImage by tasks.registering {
|
||||
dependsOn("assemble")
|
||||
|
||||
var graalVMHome = ""
|
||||
doFirst {
|
||||
graalVMHome = System.getenv("GRAALVM_HOME")
|
||||
?: throw GradleException("Required GRAALVM_HOME environment variable not set.")
|
||||
}
|
||||
|
||||
doLast {
|
||||
val nativeBinaryOutputPath = "$buildDir/native-image"
|
||||
val nativeBinaryName = "signal-cli"
|
||||
|
||||
mkdir(nativeBinaryOutputPath)
|
||||
|
||||
exec {
|
||||
workingDir = File(".")
|
||||
commandLine(
|
||||
"$graalVMHome/bin/native-image",
|
||||
"-H:Path=$nativeBinaryOutputPath",
|
||||
"-H:Name=$nativeBinaryName",
|
||||
"-H:JNIConfigurationFiles=graalvm-config-dir/jni-config.json",
|
||||
"-H:DynamicProxyConfigurationFiles=graalvm-config-dir/proxy-config.json",
|
||||
"-H:ResourceConfigurationFiles=graalvm-config-dir/resource-config.json",
|
||||
"-H:ReflectionConfigurationFiles=graalvm-config-dir/reflect-config.json",
|
||||
"--no-fallback",
|
||||
"--allow-incomplete-classpath",
|
||||
"--report-unsupported-elements-at-runtime",
|
||||
"--enable-url-protocols=http,https",
|
||||
"--enable-https",
|
||||
"--enable-all-security-services",
|
||||
"-cp",
|
||||
sourceSets.main.get().runtimeClasspath.asPath,
|
||||
application.mainClass.get()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,17 +11,22 @@ if [ ! -z "$GRAALVM_HOME" ]; then
|
|||
export JAVA_HOME=$GRAALVM_HOME
|
||||
export SIGNAL_CLI_OPTS='-agentlib:native-image-agent=config-merge-dir=graalvm-config-dir/'
|
||||
fi
|
||||
export SIGNAL_CLI="$PWD/build/install/signal-cli/bin/signal-cli"
|
||||
|
||||
NUMBER_1="$1"
|
||||
NUMBER_2="$2"
|
||||
TEST_PIN_1=456test_pin_foo123
|
||||
NATIVE=1
|
||||
|
||||
PATH_TEST_CONFIG="$PWD/build/test-config"
|
||||
PATH_MAIN="$PATH_TEST_CONFIG/main"
|
||||
PATH_LINK="$PATH_TEST_CONFIG/link"
|
||||
|
||||
./gradlew installDist
|
||||
if [ "$NATIVE" -eq 1 ]; then
|
||||
SIGNAL_CLI="$PWD/build/native/nativeCompile/signal-cli"
|
||||
else
|
||||
./gradlew installDist
|
||||
SIGNAL_CLI="$PWD/build/install/signal-cli/bin/signal-cli"
|
||||
fi
|
||||
|
||||
run() {
|
||||
set -x
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue