0
0
mirror of https://github.com/signalapp/libsignal.git synced 2024-09-20 12:02:18 +02:00
libsignal/java/build.gradle

95 lines
2.1 KiB
Groovy
Raw Normal View History

plugins {
id "de.undercouch.download" version "5.0.2"
}
2022-10-20 22:04:57 +02:00
def version_number = "0.21.1"
subprojects {
ext.version_number = version_number
ext.group_info = "org.signal"
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
allprojects {
tasks.withType(JavaCompile) {
options.compilerArgs += ["-Xlint:deprecation", "-Xlint:fallthrough", "-Xlint:unchecked"]
}
}
}
task makeJniLibrariesAndroid(type:Exec) {
group 'Rust'
description 'Build the JNI libraries'
commandLine './build_jni.sh', 'android'
}
task makeJniLibrariesDesktop(type:Exec) {
group 'Rust'
description 'Build the JNI libraries'
commandLine './build_jni.sh', 'desktop'
}
task makeAll() {
group 'Rust'
description 'Build the native libraries'
dependsOn 'makeJniLibrariesDesktop', 'makeJniLibrariesAndroid'
}
task cargoClean(type:Exec) {
group 'Rust'
commandLine 'cargo', 'clean'
}
task clean(type: Delete) {
description 'Clean JNI libs'
delete fileTree('./android/src/main/jniLibs') {
include '**/*.so'
}
java: Build a separate libsignal-server artifact Reorganize the Gradle build with three targets: - signal-client-java (client/) - signal-client-android (android/) - libsignal-server (server/) plus an additional shared/ directory for sources shared between client/ and server/. This maintains the distinction between signal-client-java (the Java parts, plus a Linux libsignal_jni.so for running tests outside of the Android emulator) and signal-client-android (contains the Android JNI libraries, plus any Android-specific code, which for now is just AndroidSignalProtocolLogger, which the app doesn't even use). The new libsignal-server is built very similarly to signal-client-java, but only contains the Java sources relevant for the server...plus the base org.whispersystems.libsignal classes from the original libsignal-protocol-java, because some of them are referenced directly in our generated Native.java. (We can improve on this in the future.) The "testable" artifact that includes macOS and Windows versions of libsignal_jni.so is now only built for libsignal-server, not signal-client-java; our Android development happens on Linux, but server development happens on multiple platforms. Tests were recently reorganized into a top-level tests/ directory, but now there's been another reorganization: - client/src/test/ - tests to run on any clients - android/src/androidTest/ - tests to run only on Android devices / emulators (currently none) - server/src/test/ - tests to run specifically for the server (currently none) - shared/test/ - does not exist to avoid running the same tests twice There are no tests to run "only not on Android devices", and it's currently assumed that all server functionality is tested by the client tests. The Android device tests run all the client tests as well (by direct path reference). This may not be the "best" Gradle layout, but it's at least straightforward to read the Gradle files. For now there's still only one native library built for both signal-client-java and libsignal-server, but that could change in the future.
2022-03-10 01:45:04 +01:00
delete fileTree('./shared/resources') {
include '**/*.so'
include '**/*.dylib'
include '**/*.dll'
}
}
clean.dependsOn(cargoClean)
task downloadNonLinuxLibraries(type: Download) {
// Must be explicitly enabled.
enabled false
def extraResources = ['signal_jni.dll', 'libsignal_jni.dylib']
src(extraResources.collect {
'https://github.com/signalapp/libsignal/releases/download/v' + version_number + '/' + it
})
dest 'shared/resources'
}
// PUBLISHING
def isReleaseBuild() {
return version.contains("SNAPSHOT") == false
}
def getReleaseRepositoryUrl() {
return hasProperty('sonatypeRepo') ? sonatypeRepo
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}
def getRepositoryUsername() {
return hasProperty('sonatypeUsername') ? sonatypeUsername : ""
}
def getRepositoryPassword() {
return hasProperty('sonatypePassword') ? sonatypePassword : ""
}