10 sourceCompatibility = JavaVersion.VERSION_11
11 targetCompatibility = JavaVersion.VERSION_11
15 mainClass.set("org.asamk.signal.Main")
24 implementation("com.google.protobuf:protobuf-javalite:3.10.0")
25 implementation("com.github.turasa:signal-service-java:2.15.3_unofficial_18")
26 implementation("org.bouncycastle:bcprov-jdk15on:1.68")
27 implementation("net.sourceforge.argparse4j:argparse4j:0.8.1")
28 implementation("com.github.hypfvieh:dbus-java:3.2.4")
29 implementation("org.slf4j:slf4j-simple:1.7.30")
34 resolutionStrategy.failOnVersionConflict()
38 tasks.withType<JavaCompile> {
39 options.encoding = "UTF-8"
45 "Implementation-Title" to project.name,
46 "Implementation-Version" to project.version,
47 "Main-Class" to application.mainClass.get()
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>
61 // Find any 3rd party libraries which have released new versions
62 // to the central Maven repo since we last upgraded.
63 val checkLibVersions by tasks.registering {
65 val checked = kotlin.collections.HashSet<Dependency>()
67 configurations.forEach { configuration ->
68 configuration.allDependencies.forEach { dependency ->
69 val version = dependency.version
70 if (!checked.contains(dependency)) {
71 val group = dependency.group
72 val path = group?.replace(".", "/") ?: ""
73 val name = dependency.name
74 val metaDataUrl = "https://repo1.maven.org/maven2/$path/$name/maven-metadata.xml"
76 val url = org.codehaus.groovy.runtime.ResourceGroovyMethods.toURL(metaDataUrl)
77 val metaDataText = org.codehaus.groovy.runtime.ResourceGroovyMethods.getText(url)
78 val metadata = groovy.util.XmlSlurper().parseText(metaDataText)
79 val newest = (metadata.getProperty("versioning") as groovy.util.slurpersupport.GPathResult).getProperty("latest")
80 if (version != newest.toString()) {
81 println("UPGRADE {\"group\": \"$group\", \"name\": \"$name\", \"current\": \"$version\", \"latest\": \"$newest\"}")
83 } catch (e: Throwable) {
84 logger.debug("Unable to download or parse $metaDataUrl: $e.message")
86 checked.add(dependency)
94 val assembleNativeImage by tasks.registering {
99 graalVMHome = System.getenv("GRAALVM_HOME")
100 ?: throw GradleException("Required GRAALVM_HOME environment variable not set.")
104 val nativeBinaryOutputPath = "$buildDir/native-image"
105 val nativeBinaryName = "signal-cli"
107 mkdir(nativeBinaryOutputPath)
110 workingDir = File(".")
111 commandLine("$graalVMHome/bin/native-image",
112 "-H:Path=$nativeBinaryOutputPath",
113 "-H:Name=$nativeBinaryName",
114 "-H:JNIConfigurationFiles=graalvm-config-dir/jni-config.json",
115 "-H:DynamicProxyConfigurationFiles=graalvm-config-dir/proxy-config.json",
116 "-H:ResourceConfigurationFiles=graalvm-config-dir/resource-config.json",
117 "-H:ReflectionConfigurationFiles=graalvm-config-dir/reflect-config.json",
119 "--allow-incomplete-classpath",
120 "--report-unsupported-elements-at-runtime",
121 "--enable-url-protocols=http,https",
123 "--enable-all-security-services",
125 sourceSets.main.get().runtimeClasspath.asPath,
126 application.mainClass.get())