]> nmode's Git Repositories - signal-cli/blob - build.gradle.kts
70f2a2b4dbc52f7113b8dc06a826d5f4f4abe4fa
[signal-cli] / build.gradle.kts
1 plugins {
2 java
3 application
4 eclipse
5 `check-lib-versions`
6 }
7
8 version = "0.8.3"
9
10 java {
11 sourceCompatibility = JavaVersion.VERSION_11
12 targetCompatibility = JavaVersion.VERSION_11
13 }
14
15 application {
16 mainClass.set("org.asamk.signal.Main")
17 }
18
19 repositories {
20 mavenLocal()
21 mavenCentral()
22 }
23
24 dependencies {
25 implementation("org.bouncycastle:bcprov-jdk15on:1.68")
26 implementation("net.sourceforge.argparse4j:argparse4j:0.9.0")
27 implementation("com.github.hypfvieh:dbus-java:3.3.0")
28 implementation("org.slf4j:slf4j-simple:1.7.30")
29 implementation(project(":lib"))
30 }
31
32 configurations {
33 implementation {
34 resolutionStrategy.failOnVersionConflict()
35 }
36 }
37
38
39 tasks.withType<AbstractArchiveTask>().configureEach {
40 isPreserveFileTimestamps = false
41 isReproducibleFileOrder = true
42 }
43
44 tasks.withType<JavaCompile> {
45 options.encoding = "UTF-8"
46 }
47
48 tasks.withType<Jar> {
49 manifest {
50 attributes(
51 "Implementation-Title" to project.name,
52 "Implementation-Version" to project.version,
53 "Main-Class" to application.mainClass.get()
54 )
55 }
56 }
57
58 tasks.withType<JavaExec> {
59 val appArgs: String? by project
60 if (appArgs != null) {
61 // allow passing command-line arguments to the main application e.g.:
62 // $ gradle run -PappArgs="['-u', '+...', 'daemon', '--json']"
63 args = groovy.util.Eval.me(appArgs) as MutableList<String>
64 }
65 }
66
67 val assembleNativeImage by tasks.registering {
68 dependsOn("assemble")
69
70 var graalVMHome = ""
71 doFirst {
72 graalVMHome = System.getenv("GRAALVM_HOME")
73 ?: throw GradleException("Required GRAALVM_HOME environment variable not set.")
74 }
75
76 doLast {
77 val nativeBinaryOutputPath = "$buildDir/native-image"
78 val nativeBinaryName = "signal-cli"
79
80 mkdir(nativeBinaryOutputPath)
81
82 exec {
83 workingDir = File(".")
84 commandLine("$graalVMHome/bin/native-image",
85 "-H:Path=$nativeBinaryOutputPath",
86 "-H:Name=$nativeBinaryName",
87 "-H:JNIConfigurationFiles=graalvm-config-dir/jni-config.json",
88 "-H:DynamicProxyConfigurationFiles=graalvm-config-dir/proxy-config.json",
89 "-H:ResourceConfigurationFiles=graalvm-config-dir/resource-config.json",
90 "-H:ReflectionConfigurationFiles=graalvm-config-dir/reflect-config.json",
91 "--no-fallback",
92 "--allow-incomplete-classpath",
93 "--report-unsupported-elements-at-runtime",
94 "--enable-url-protocols=http,https",
95 "--enable-https",
96 "--enable-all-security-services",
97 "-cp",
98 sourceSets.main.get().runtimeClasspath.asPath,
99 application.mainClass.get())
100 }
101 }
102 }