buildscript { dependencies { // This isn't compatible with the `plugins` lookup method, so it has to // be declared in a `buildscript` block. See // https://github.com/gradle/gradle/issues/1541 for info. classpath 'com.guardsquare:proguard-gradle:7.4.2' } } plugins { id 'java-library' id 'maven-publish' id 'signing' id 'org.jetbrains.kotlin.jvm' } sourceCompatibility = 17 archivesBaseName = "libsignal-client" repositories { mavenCentral() mavenLocal() } sourceSets { main { java { // Include libsignal sources shared between the client and server srcDir '../shared/java' } kotlin { srcDir 'src/main/java' // Include libsignal sources shared between the client and server srcDir '../shared/java' } resources { srcDir '../shared/resources' } } test { java { srcDir '../shared/test/java' } kotlin { srcDir 'src/test/java' srcDir '../shared/test/java' } } } dependencies { testImplementation 'junit:junit:4.13' testImplementation 'com.googlecode.json-simple:json-simple:1.1' testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.2' testImplementation 'org.jetbrains.kotlin:kotlin-test:2.1.0' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2' } test { jvmArgs '-Xcheck:jni' testLogging { events 'passed','skipped','failed' showStandardStreams = true showExceptions true exceptionFormat 'full' showCauses true showStackTraces true } } java { withSourcesJar() } kotlin { explicitApi() } sourcesJar { // Cut down on artifact size by leaving these out of the sources jar. exclude '*.dll' exclude '*.dylib' exclude '*.so' } task dokkaHtmlJar(type: Jar) { dependsOn(dokkaHtml) from(dokkaHtml) archiveClassifier.set("dokka") } task dokkaJavadocJar(type: Jar) { dependsOn(dokkaJavadoc) from(dokkaJavadoc) archiveClassifier.set("javadoc") } tasks.named('jar') { manifest { attributes('Automatic-Module-Name': 'org.signal.libsignal') } } processResources { dependsOn ':makeJniLibrariesDesktop' } // MARK: Publishing publishing { publications { mavenJava(MavenPublication) { artifactId = archivesBaseName from components.java artifact dokkaHtmlJar artifact dokkaJavadocJar pom { name = archivesBaseName description = 'Signal Protocol cryptography library for Java' url = 'https://github.com/signalapp/libsignal' scm { url = 'scm:git@github.com:signalapp/libsignal.git' connection = 'scm:git@github.com:signalapp/libsignal.git' developerConnection = 'scm:git@github.com:signalapp/libsignal.git' } licenses { license { name = 'AGPLv3' url = 'https://www.gnu.org/licenses/agpl-3.0.txt' } } developers { developer { name = 'Signal Messenger LLC' } } } } } } setUpSigningKey(signing) signing { required { isReleaseBuild() && gradle.taskGraph.hasTask(":client:publish") } sign publishing.publications.mavenJava }