0
0
mirror of https://github.com/signalapp/libsignal.git synced 2024-09-20 12:02:18 +02:00
libsignal/java/android/build.gradle
Alex Konradi 7f023e7d46
Fix exclude for libsignal-net tests on Android
Use the path within the directory specified by srcDir without the common
prefix. Verified with ./gradlew test :android:connectedDebugAndroidTest
locally.
2023-11-16 14:47:17 -05:00

118 lines
3.2 KiB
Groovy

plugins {
id 'com.android.library' version '7.0.0'
id 'maven-publish'
id 'signing'
}
archivesBaseName = "libsignal-android"
repositories {
google()
mavenCentral()
mavenLocal()
}
android {
compileSdkVersion 30
buildToolsVersion '30.0.2'
ndkVersion '25.2.9519653'
defaultConfig {
minSdkVersion 21
targetSdkVersion 30
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
sourceSets {
androidTest {
java {
// Also run all the Android-agnostic tests by default.
srcDir '../client/src/test/java'
srcDir '../shared/test/java'
// Exclude tests that depend on libsignal TESTING_ functions,
// which aren't exported on Android.
exclude 'org/signal/libsignal/net/**'
}
resources {
srcDir '../client/src/test/resources'
}
}
}
}
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'
classifier 'debug-symbols'
}
preBuild {
dependsOn 'makeJniLibraries'
}
task makeJniLibraries(type:Exec) {
group 'Rust'
description 'Build the JNI libraries'
// Explicitly specify 'bash' for Windows compatibility.
commandLine 'bash', '../build_jni.sh', 'android'
environment 'ANDROID_NDK_HOME', android.ndkDirectory
}
// 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
}
}