]> nmode's Git Repositories - signal-cli/blob - build.gradle
Update libsignal
[signal-cli] / build.gradle
1 apply plugin: 'java'
2 apply plugin: 'application'
3 apply plugin: 'eclipse'
4
5 sourceCompatibility = JavaVersion.VERSION_11
6 targetCompatibility = JavaVersion.VERSION_11
7
8 mainClassName = 'org.asamk.signal.Main'
9
10 version = '0.7.4'
11
12 compileJava.options.encoding = 'UTF-8'
13
14 repositories {
15 mavenLocal()
16 mavenCentral()
17 }
18
19 dependencies {
20 implementation 'com.google.protobuf:protobuf-javalite:3.10.0'
21 implementation 'com.github.turasa:signal-service-java:2.15.3_unofficial_18'
22 implementation 'org.bouncycastle:bcprov-jdk15on:1.68'
23 implementation 'net.sourceforge.argparse4j:argparse4j:0.8.1'
24 implementation 'com.github.hypfvieh:dbus-java:3.2.4'
25 implementation 'org.slf4j:slf4j-simple:1.7.30'
26 }
27
28 jar {
29 manifest {
30 attributes(
31 'Implementation-Title': project.name,
32 'Implementation-Version': project.version,
33 'Main-Class': project.mainClassName,
34 )
35 }
36 }
37
38 run {
39 if (project.hasProperty("appArgs")) {
40 // allow passing command-line arguments to the main application e.g.:
41 // $ gradle run -PappArgs="['-u', '+...', 'daemon', '--json']"
42 args Eval.me(appArgs)
43 }
44 }
45
46 // Find any 3rd party libraries which have released new versions
47 // to the central Maven repo since we last upgraded.
48 task checkLibVersions {
49 doLast {
50 def checked = [:]
51 allprojects {
52 configurations.each { configuration ->
53 configuration.allDependencies.each { dependency ->
54 def version = dependency.version
55 if (!checked[dependency]) {
56 def group = dependency.group
57 def path = group.replace('.', '/')
58 def name = dependency.name
59 def url = "https://repo1.maven.org/maven2/$path/$name/maven-metadata.xml"
60 try {
61 def metadata = new XmlSlurper().parseText(url.toURL().text)
62 def newest = metadata.versioning.latest;
63 if ("$version" != "$newest") {
64 println "UPGRADE {\"group\": \"$group\", \"name\": \"$name\", \"current\": \"$version\", \"latest\": \"$newest\"}"
65 }
66 } catch (FileNotFoundException e) {
67 logger.debug "Unable to download $url: $e.message"
68 } catch (org.xml.sax.SAXParseException e) {
69 logger.debug "Unable to parse $url: $e.message"
70 }
71 checked[dependency] = true
72 }
73 }
74 }
75 }
76 }
77 }
78
79 task assembleNativeImage {
80 dependsOn("assemble")
81 doLast {
82 def graalVMHome = System.getenv("GRAALVM_HOME")
83 if (!graalVMHome) {
84 throw new GradleException('Required GRAALVM_HOME environment variable not set.')
85 }
86 def nativeBinaryOutputPath = "$buildDir/native-image"
87 def nativeBinaryName = "signal-cli"
88
89 mkdir nativeBinaryOutputPath
90
91 exec {
92 workingDir "."
93 commandLine "$graalVMHome/bin/native-image",
94 "-H:Path=$nativeBinaryOutputPath",
95 "-H:Name=$nativeBinaryName",
96 "-H:JNIConfigurationFiles=graalvm-config-dir/jni-config.json",
97 "-H:DynamicProxyConfigurationFiles=graalvm-config-dir/proxy-config.json",
98 "-H:ResourceConfigurationFiles=graalvm-config-dir/resource-config.json",
99 "-H:ReflectionConfigurationFiles=graalvm-config-dir/reflect-config.json",
100 "--no-fallback",
101 "--allow-incomplete-classpath",
102 "--report-unsupported-elements-at-runtime",
103 "--enable-url-protocols=http,https",
104 "--enable-https",
105 "--enable-all-security-services",
106 "-cp",
107 sourceSets.main.runtimeClasspath.asPath,
108 project.mainClassName
109 }
110 }
111 }