X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/52739140ef7e1628d3bcda6474b4c13479fe86d1..a0c304d3cab59073ea37949b9d580cd9fb20c3e1:/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts index 55d95145..d0ef32f6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,29 +3,43 @@ plugins { application eclipse `check-lib-versions` + id("org.graalvm.buildtools.native") version "0.9.11" } -version = "0.8.1" +version = "0.10.5" java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } application { mainClass.set("org.asamk.signal.Main") } +graalvmNative { + binaries { + this["main"].run { + configurationFileDirectories.from(file("graalvm-config-dir")) + buildArgs.add("--allow-incomplete-classpath") + buildArgs.add("--report-unsupported-elements-at-runtime") + } + } +} + repositories { mavenLocal() mavenCentral() } dependencies { - implementation("org.bouncycastle:bcprov-jdk15on:1.68") - implementation("net.sourceforge.argparse4j:argparse4j:0.8.1") - implementation("com.github.hypfvieh:dbus-java:3.2.4") - implementation("org.slf4j:slf4j-simple:1.7.30") + implementation("org.bouncycastle", "bcprov-jdk15on", "1.70") + implementation("com.fasterxml.jackson.core", "jackson-databind", "2.13.2.2") + implementation("net.sourceforge.argparse4j", "argparse4j", "0.9.0") + implementation("com.github.hypfvieh", "dbus-java-transport-native-unixsocket", "4.0.0") + implementation("org.slf4j", "slf4j-api", "1.7.36") + implementation("ch.qos.logback", "logback-classic", "1.2.11") + implementation("org.slf4j", "jul-to-slf4j", "1.7.36") implementation(project(":lib")) } @@ -35,6 +49,12 @@ configurations { } } + +tasks.withType().configureEach { + isPreserveFileTimestamps = false + isReproducibleFileOrder = true +} + tasks.withType { options.encoding = "UTF-8" } @@ -42,55 +62,23 @@ tasks.withType { tasks.withType { manifest { attributes( - "Implementation-Title" to project.name, - "Implementation-Version" to project.version, - "Main-Class" to application.mainClass.get() + "Implementation-Title" to project.name, + "Implementation-Version" to project.version, + "Main-Class" to application.mainClass.get() ) } } -tasks.withType { - val appArgs: String? by project - if (appArgs != null) { - // allow passing command-line arguments to the main application e.g.: - // $ gradle run -PappArgs="['-u', '+...', 'daemon', '--json']" - args = groovy.util.Eval.me(appArgs) as MutableList - } -} - -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()) - } - } +task("fatJar", type = Jar::class) { + archiveBaseName.set("${project.name}-fat") + exclude( + "META-INF/*.SF", + "META-INF/*.DSA", + "META-INF/*.RSA", + "META-INF/NOTICE", + "META-INF/LICENSE", + "**/module-info.class" + ) + from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) }) + with(tasks.jar.get() as CopySpec) }