]> nmode's Git Repositories - signal-cli/blob - build.gradle.kts
Return URI instead of String
[signal-cli] / build.gradle.kts
1 plugins {
2 java
3 application
4 eclipse
5 `check-lib-versions`
6 }
7
8 version = "0.8.1"
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.8.1")
27 implementation("com.github.hypfvieh:dbus-java:3.2.4")
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 tasks.withType<JavaCompile> {
39 options.encoding = "UTF-8"
40 }
41
42 tasks.withType<Jar> {
43 manifest {
44 attributes(
45 "Implementation-Title" to project.name,
46 "Implementation-Version" to project.version,
47 "Main-Class" to application.mainClass.get()
48 )
49 }
50 }
51
52 tasks.withType<JavaExec> {
53 val appArgs: String? by project
54 if (appArgs != null) {
55 // allow passing command-line arguments to the main application e.g.:
56 // $ gradle run -PappArgs="['-u', '+...', 'daemon', '--json']"
57 args = groovy.util.Eval.me(appArgs) as MutableList<String>
58 }
59 }
60
61 val assembleNativeImage by tasks.registering {
62 dependsOn("assemble")
63
64 var graalVMHome = ""
65 doFirst {
66 graalVMHome = System.getenv("GRAALVM_HOME")
67 ?: throw GradleException("Required GRAALVM_HOME environment variable not set.")
68 }
69
70 doLast {
71 val nativeBinaryOutputPath = "$buildDir/native-image"
72 val nativeBinaryName = "signal-cli"
73
74 mkdir(nativeBinaryOutputPath)
75
76 exec {
77 workingDir = File(".")
78 commandLine("$graalVMHome/bin/native-image",
79 "-H:Path=$nativeBinaryOutputPath",
80 "-H:Name=$nativeBinaryName",
81 "-H:JNIConfigurationFiles=graalvm-config-dir/jni-config.json",
82 "-H:DynamicProxyConfigurationFiles=graalvm-config-dir/proxy-config.json",
83 "-H:ResourceConfigurationFiles=graalvm-config-dir/resource-config.json",
84 "-H:ReflectionConfigurationFiles=graalvm-config-dir/reflect-config.json",
85 "--no-fallback",
86 "--allow-incomplete-classpath",
87 "--report-unsupported-elements-at-runtime",
88 "--enable-url-protocols=http,https",
89 "--enable-https",
90 "--enable-all-security-services",
91 "-cp",
92 sourceSets.main.get().runtimeClasspath.asPath,
93 application.mainClass.get())
94 }
95 }
96 }