10 sourceCompatibility = JavaVersion.VERSION_11
11 targetCompatibility = JavaVersion.VERSION_11
15 mainClass.set("org.asamk.signal.Main")
24 implementation("org.bouncycastle:bcprov-jdk15on:1.68")
25 implementation("net.sourceforge.argparse4j:argparse4j:0.8.1")
26 implementation("com.github.hypfvieh:dbus-java:3.2.4")
27 implementation("org.slf4j:slf4j-simple:1.7.30")
28 implementation(project(":lib"))
33 resolutionStrategy.failOnVersionConflict()
37 tasks.withType<JavaCompile> {
38 options.encoding = "UTF-8"
44 "Implementation-Title" to project.name,
45 "Implementation-Version" to project.version,
46 "Main-Class" to application.mainClass.get()
51 tasks.withType<JavaExec> {
52 val appArgs: String? by project
53 if (appArgs != null) {
54 // allow passing command-line arguments to the main application e.g.:
55 // $ gradle run -PappArgs="['-u', '+...', 'daemon', '--json']"
56 args = groovy.util.Eval.me(appArgs) as MutableList<String>
60 // Find any 3rd party libraries which have released new versions
61 // to the central Maven repo since we last upgraded.
62 val checkLibVersions by tasks.registering {
64 val checked = kotlin.collections.HashSet<Dependency>()
66 configurations.forEach { configuration ->
67 configuration.allDependencies.forEach { dependency ->
68 val version = dependency.version
69 if (!checked.contains(dependency)) {
70 val group = dependency.group
71 val path = group?.replace(".", "/") ?: ""
72 val name = dependency.name
73 val metaDataUrl = "https://repo1.maven.org/maven2/$path/$name/maven-metadata.xml"
75 val url = org.codehaus.groovy.runtime.ResourceGroovyMethods.toURL(metaDataUrl)
76 val metaDataText = org.codehaus.groovy.runtime.ResourceGroovyMethods.getText(url)
77 val metadata = groovy.util.XmlSlurper().parseText(metaDataText)
78 val newest = (metadata.getProperty("versioning") as groovy.util.slurpersupport.GPathResult).getProperty("latest")
79 if (version != newest.toString()) {
80 println("UPGRADE {\"group\": \"$group\", \"name\": \"$name\", \"current\": \"$version\", \"latest\": \"$newest\"}")
82 } catch (e: Throwable) {
83 logger.debug("Unable to download or parse $metaDataUrl: $e.message")
85 checked.add(dependency)
93 val assembleNativeImage by tasks.registering {
98 graalVMHome = System.getenv("GRAALVM_HOME")
99 ?: throw GradleException("Required GRAALVM_HOME environment variable not set.")
103 val nativeBinaryOutputPath = "$buildDir/native-image"
104 val nativeBinaryName = "signal-cli"
106 mkdir(nativeBinaryOutputPath)
109 workingDir = File(".")
110 commandLine("$graalVMHome/bin/native-image",
111 "-H:Path=$nativeBinaryOutputPath",
112 "-H:Name=$nativeBinaryName",
113 "-H:JNIConfigurationFiles=graalvm-config-dir/jni-config.json",
114 "-H:DynamicProxyConfigurationFiles=graalvm-config-dir/proxy-config.json",
115 "-H:ResourceConfigurationFiles=graalvm-config-dir/resource-config.json",
116 "-H:ReflectionConfigurationFiles=graalvm-config-dir/reflect-config.json",
118 "--allow-incomplete-classpath",
119 "--report-unsupported-elements-at-runtime",
120 "--enable-url-protocols=http,https",
122 "--enable-all-security-services",
124 sourceSets.main.get().runtimeClasspath.asPath,
125 application.mainClass.get())