]> nmode's Git Repositories - signal-cli/blob - build.gradle.kts
Add fatJar gradle task to create a single executable jar file
[signal-cli] / build.gradle.kts
1 plugins {
2 java
3 application
4 eclipse
5 `check-lib-versions`
6 id("org.graalvm.buildtools.native") version "0.9.6"
7 }
8
9 version = "0.9.2"
10
11 java {
12 sourceCompatibility = JavaVersion.VERSION_17
13 targetCompatibility = JavaVersion.VERSION_17
14 }
15
16 application {
17 mainClass.set("org.asamk.signal.Main")
18 }
19
20 graalvmNative {
21 binaries {
22 this["main"].run {
23 configurationFileDirectories.from(file("graalvm-config-dir"))
24 buildArgs.add("--allow-incomplete-classpath")
25 buildArgs.add("--report-unsupported-elements-at-runtime")
26 }
27 }
28 }
29
30 repositories {
31 mavenLocal()
32 mavenCentral()
33 }
34
35 dependencies {
36 implementation("org.bouncycastle:bcprov-jdk15on:1.69")
37 implementation("net.sourceforge.argparse4j:argparse4j:0.9.0")
38 implementation("com.github.hypfvieh:dbus-java:3.3.1")
39 implementation("org.slf4j:slf4j-simple:1.7.32")
40 implementation(project(":lib"))
41 }
42
43 configurations {
44 implementation {
45 resolutionStrategy.failOnVersionConflict()
46 }
47 }
48
49
50 tasks.withType<AbstractArchiveTask>().configureEach {
51 isPreserveFileTimestamps = false
52 isReproducibleFileOrder = true
53 }
54
55 tasks.withType<JavaCompile> {
56 options.encoding = "UTF-8"
57 }
58
59 tasks.withType<Jar> {
60 manifest {
61 attributes(
62 "Implementation-Title" to project.name,
63 "Implementation-Version" to project.version,
64 "Main-Class" to application.mainClass.get()
65 )
66 }
67 }
68
69 task("fatJar", type = Jar::class) {
70 archiveBaseName.set("${project.name}-fat")
71 exclude(
72 "META-INF/*.SF",
73 "META-INF/*.DSA",
74 "META-INF/*.RSA",
75 "META-INF/NOTICE",
76 "META-INF/LICENSE",
77 "**/module-info.class"
78 )
79 from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
80 with(tasks.jar.get() as CopySpec)
81 }