mirror of
https://github.com/signalapp/libsignal.git
synced 2026-05-12 18:07:08 +02:00
Each of these updates is required for the following update, and the final one allows us to use 'record'. The target SDK version is set to 33, matching the Android app.
152 lines
4.1 KiB
Groovy
152 lines
4.1 KiB
Groovy
plugins {
|
|
id 'com.android.library' version '8.3.0'
|
|
id 'maven-publish'
|
|
id 'signing'
|
|
}
|
|
|
|
archivesBaseName = "libsignal-android"
|
|
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
mavenLocal()
|
|
}
|
|
|
|
android {
|
|
namespace 'org.signal.libsignal'
|
|
|
|
compileSdk 34
|
|
ndkVersion '25.2.9519653'
|
|
|
|
defaultConfig {
|
|
minSdkVersion 21
|
|
targetSdkVersion 33
|
|
multiDexEnabled true
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
}
|
|
|
|
compileOptions {
|
|
coreLibraryDesugaringEnabled true
|
|
sourceCompatibility JavaVersion.VERSION_17
|
|
targetCompatibility JavaVersion.VERSION_17
|
|
}
|
|
|
|
sourceSets {
|
|
androidTest {
|
|
java {
|
|
// Also run all the Android-agnostic tests by default.
|
|
srcDir '../client/src/test/java'
|
|
srcDir '../shared/test/java'
|
|
}
|
|
resources {
|
|
srcDir '../client/src/test/resources'
|
|
}
|
|
}
|
|
}
|
|
|
|
packagingOptions {
|
|
jniLibs {
|
|
pickFirst 'lib/*/libsignal_jni.so'
|
|
}
|
|
}
|
|
|
|
publishing {
|
|
singleVariant('release')
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
androidTestImplementation "androidx.test:runner:1.4.0"
|
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.6'
|
|
api project(':client')
|
|
}
|
|
|
|
tasks.register('libsWithDebugSymbols', Zip) {
|
|
from 'src/main/jniLibs'
|
|
archiveClassifier = 'debug-symbols'
|
|
dependsOn 'makeJniLibraries'
|
|
}
|
|
|
|
preBuild {
|
|
dependsOn 'collectAssets'
|
|
dependsOn 'makeJniLibraries'
|
|
dependsOn 'makeTestJniLibraries'
|
|
}
|
|
|
|
String[] archsFromProperty(String prop) {
|
|
findProperty(prop)?.split(',')?.findAll { it != '' }?.collect { 'android-' + it }
|
|
}
|
|
|
|
task makeJniLibraries(type:Exec) {
|
|
group 'Rust'
|
|
description 'Build the JNI libraries for Android'
|
|
|
|
def archs = archsFromProperty('androidArchs') ?: ['android']
|
|
// Explicitly specify 'bash' for Windows compatibility.
|
|
commandLine 'bash', '../build_jni.sh', *archs
|
|
environment 'ANDROID_NDK_HOME', android.ndkDirectory
|
|
}
|
|
|
|
task makeTestJniLibraries(type:Exec) {
|
|
group 'Rust'
|
|
description 'Build JNI libraries for Android for testing'
|
|
|
|
def archs = archsFromProperty('androidTestingArchs') ?: archsFromProperty('androidArchs') ?: ['android']
|
|
// Explicitly specify 'bash' for Windows compatibility.
|
|
commandLine 'bash', '../build_jni.sh', '--testing', *archs
|
|
environment 'ANDROID_NDK_HOME', android.ndkDirectory
|
|
}
|
|
|
|
task collectAssets(type:Copy) {
|
|
from('../../acknowledgments/acknowledgments.md') {
|
|
rename 'acknowledgments.md', 'libsignal.md'
|
|
}
|
|
into 'src/main/assets/acknowledgments'
|
|
}
|
|
|
|
// MARK: Publication
|
|
afterEvaluate {
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
artifactId = archivesBaseName
|
|
from components.release
|
|
artifact libsWithDebugSymbols
|
|
|
|
pom {
|
|
name = archivesBaseName
|
|
packaging = 'aar'
|
|
description = 'Signal Protocol cryptography library for Android'
|
|
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(":android:publish") }
|
|
sign publishing.publications.mavenJava
|
|
}
|
|
}
|