refactored native-build.sh to a gradle task buildNativeBinary

This commit is contained in:
Michael Kebe 2021-01-23 00:51:49 +01:00
parent fef1321abe
commit 3e148ea41a
2 changed files with 32 additions and 35 deletions

View file

@ -75,8 +75,38 @@ task checkLibVersions {
}
}
task printRuntimeClasspath {
task buildNativeBinary {
dependsOn("build")
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
}
}
}