mirror of
https://github.com/AsamK/signal-cli
synced 2025-09-02 12:30:39 +00:00
refactored native-build.sh to a gradle task buildNativeBinary
This commit is contained in:
parent
fef1321abe
commit
3e148ea41a
2 changed files with 32 additions and 35 deletions
34
build.gradle
34
build.gradle
|
@ -75,8 +75,38 @@ task checkLibVersions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task printRuntimeClasspath {
|
task buildNativeBinary {
|
||||||
|
dependsOn("build")
|
||||||
doLast {
|
doLast {
|
||||||
print sourceSets.main.runtimeClasspath.asPath
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
if [ -z "$GRAALVM_HOME" ]; then
|
|
||||||
echo "The GRAALVM_HOME environment variable is required.\n\n e.g. export GRAALVM_HOME=../graalvm-ce-java11-21.0.0/\n" 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
export JAVA_HOME=$GRAALVM_HOME
|
|
||||||
|
|
||||||
./gradlew clean build
|
|
||||||
|
|
||||||
RUNTIME_CLASSPATH=$(./gradlew -q printRuntimeClasspath)
|
|
||||||
|
|
||||||
mkdir -p build/native-image
|
|
||||||
|
|
||||||
echo Compiling native-image...
|
|
||||||
$GRAALVM_HOME/bin/native-image \
|
|
||||||
-cp "$RUNTIME_CLASSPATH"\
|
|
||||||
-H:Path=build/native-image\
|
|
||||||
-H:Name=signal-cli\
|
|
||||||
-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\
|
|
||||||
org.asamk.signal.Main
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue