mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-28 18:10:38 +00:00
139 lines
3.6 KiB
Kotlin
139 lines
3.6 KiB
Kotlin
plugins {
|
|
java
|
|
application
|
|
eclipse
|
|
`check-lib-versions`
|
|
id("org.graalvm.buildtools.native") version "0.10.6"
|
|
}
|
|
|
|
allprojects {
|
|
group = "org.asamk"
|
|
version = "0.13.16-SNAPSHOT"
|
|
}
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_21
|
|
targetCompatibility = JavaVersion.VERSION_21
|
|
|
|
if (!JavaVersion.current().isCompatibleWith(targetCompatibility)) {
|
|
toolchain {
|
|
languageVersion.set(JavaLanguageVersion.of(targetCompatibility.majorVersion))
|
|
}
|
|
}
|
|
}
|
|
|
|
application {
|
|
mainClass.set("org.asamk.signal.Main")
|
|
applicationDefaultJvmArgs = listOf("--enable-native-access=ALL-UNNAMED")
|
|
}
|
|
|
|
graalvmNative {
|
|
binaries {
|
|
this["main"].run {
|
|
buildArgs.add("--install-exit-handlers")
|
|
buildArgs.add("-Dfile.encoding=UTF-8")
|
|
buildArgs.add("-J-Dfile.encoding=UTF-8")
|
|
buildArgs.add("-march=compatibility")
|
|
resources.autodetect()
|
|
configurationFileDirectories.from(file("graalvm-config-dir"))
|
|
if (System.getenv("GRAALVM_HOME") == null) {
|
|
toolchainDetection.set(true)
|
|
javaLauncher.set(javaToolchains.launcherFor {
|
|
languageVersion.set(JavaLanguageVersion.of(21))
|
|
})
|
|
} else {
|
|
toolchainDetection.set(false)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
val artifactType = Attribute.of("artifactType", String::class.java)
|
|
val minified = Attribute.of("minified", Boolean::class.javaObjectType)
|
|
dependencies {
|
|
attributesSchema {
|
|
attribute(minified)
|
|
}
|
|
artifactTypes.getByName("jar") {
|
|
attributes.attribute(minified, false)
|
|
}
|
|
}
|
|
|
|
configurations.runtimeClasspath.configure {
|
|
attributes {
|
|
attribute(minified, true)
|
|
}
|
|
}
|
|
val excludePatterns = mapOf(
|
|
"libsignal-client" to setOf(
|
|
"libsignal_jni_testing_amd64.so",
|
|
"signal_jni_testing_amd64.dll",
|
|
"libsignal_jni_testing_amd64.dylib",
|
|
"libsignal_jni_testing_aarch64.dylib",
|
|
)
|
|
)
|
|
|
|
dependencies {
|
|
registerTransform(JarFileExcluder::class) {
|
|
from.attribute(minified, false).attribute(artifactType, "jar")
|
|
to.attribute(minified, true).attribute(artifactType, "jar")
|
|
|
|
parameters {
|
|
excludeFilesByArtifact = excludePatterns
|
|
}
|
|
}
|
|
|
|
implementation(libs.bouncycastle)
|
|
implementation(libs.jackson.databind)
|
|
implementation(libs.argparse4j)
|
|
implementation(libs.dbusjava)
|
|
implementation(libs.slf4j.api)
|
|
implementation(libs.slf4j.jul)
|
|
implementation(libs.logback)
|
|
implementation(project(":libsignal-cli"))
|
|
}
|
|
|
|
configurations {
|
|
implementation {
|
|
resolutionStrategy.failOnVersionConflict()
|
|
}
|
|
}
|
|
|
|
|
|
tasks.withType<AbstractArchiveTask>().configureEach {
|
|
isPreserveFileTimestamps = false
|
|
isReproducibleFileOrder = true
|
|
}
|
|
|
|
tasks.withType<JavaCompile> {
|
|
options.encoding = "UTF-8"
|
|
}
|
|
|
|
tasks.withType<Jar> {
|
|
manifest {
|
|
attributes(
|
|
"Implementation-Title" to project.name,
|
|
"Implementation-Version" to project.version,
|
|
"Main-Class" to application.mainClass.get(),
|
|
"Enable-Native-Access" to "ALL-UNNAMED",
|
|
)
|
|
}
|
|
}
|
|
|
|
tasks.register("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*",
|
|
"META-INF/INDEX.LIST",
|
|
"**/module-info.class",
|
|
)
|
|
duplicatesStrategy = DuplicatesStrategy.WARN
|
|
doFirst {
|
|
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
|
|
}
|
|
with(tasks.jar.get())
|
|
}
|