mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-10 10:28:39 +00:00

Implement the org.signal.ringrtc.Log.Logger interface, using org.thoughtcrime.securesms.logging.Log as the underlying logger. This allows ringrtc to log in the same way as the rest of the application.
444 lines
17 KiB
Groovy
444 lines
17 KiB
Groovy
import org.signal.signing.ApkSignerUtil
|
|
|
|
import java.security.MessageDigest
|
|
|
|
buildscript {
|
|
repositories {
|
|
google()
|
|
maven {
|
|
url "https://repo1.maven.org/maven2"
|
|
}
|
|
jcenter {
|
|
content {
|
|
includeVersion 'org.jetbrains.trove4j', 'trove4j', '20160824'
|
|
}
|
|
}
|
|
}
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:3.5.1'
|
|
classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.1.0'
|
|
}
|
|
}
|
|
|
|
apply plugin: 'com.android.application'
|
|
apply plugin: 'androidx.navigation.safeargs'
|
|
apply plugin: 'witness'
|
|
apply from: 'translations.gradle'
|
|
apply from: 'witness-verifications.gradle'
|
|
|
|
repositories {
|
|
maven {
|
|
url "https://raw.github.com/signalapp/maven/master/photoview/releases/"
|
|
content {
|
|
includeGroupByRegex "com\\.github\\.chrisbanes.*"
|
|
}
|
|
}
|
|
maven {
|
|
url "https://raw.github.com/signalapp/maven/master/shortcutbadger/releases/"
|
|
content {
|
|
includeGroupByRegex "me\\.leolin.*"
|
|
}
|
|
}
|
|
maven {
|
|
url "https://raw.github.com/signalapp/maven/master/circular-progress-button/releases/"
|
|
content {
|
|
includeGroupByRegex "com\\.github\\.dmytrodanylyk\\.circular-progress-button\\.*"
|
|
}
|
|
}
|
|
maven {
|
|
url "https://raw.github.com/signalapp/maven/master/sqlcipher/release/"
|
|
content {
|
|
includeGroupByRegex "org\\.signal.*"
|
|
}
|
|
}
|
|
maven { // textdrawable
|
|
url 'https://dl.bintray.com/amulyakhare/maven'
|
|
content {
|
|
includeGroupByRegex "com\\.amulyakhare.*"
|
|
}
|
|
}
|
|
google()
|
|
jcenter()
|
|
mavenLocal()
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'androidx.appcompat:appcompat:1.1.0-beta01'
|
|
implementation 'androidx.recyclerview:recyclerview:1.0.0'
|
|
implementation 'com.google.android.material:material:1.0.0'
|
|
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
|
implementation 'androidx.cardview:cardview:1.0.0'
|
|
implementation 'androidx.preference:preference:1.0.0'
|
|
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
|
|
implementation 'androidx.gridlayout:gridlayout:1.0.0'
|
|
implementation 'androidx.exifinterface:exifinterface:1.0.0'
|
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
|
implementation 'androidx.multidex:multidex:2.0.1'
|
|
implementation 'androidx.navigation:navigation-fragment:2.1.0'
|
|
implementation 'androidx.navigation:navigation-ui:2.1.0'
|
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
|
|
implementation 'androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-alpha05'
|
|
implementation 'androidx.lifecycle:lifecycle-common-java8:2.1.0'
|
|
implementation "androidx.camera:camera-core:1.0.0-alpha06"
|
|
implementation "androidx.camera:camera-camera2:1.0.0-alpha06"
|
|
|
|
implementation('com.google.firebase:firebase-messaging:17.3.4') {
|
|
exclude group: 'com.google.firebase', module: 'firebase-core'
|
|
exclude group: 'com.google.firebase', module: 'firebase-analytics'
|
|
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
|
|
}
|
|
|
|
implementation 'com.google.android.gms:play-services-maps:16.1.0'
|
|
implementation 'com.google.android.gms:play-services-auth:16.0.1'
|
|
|
|
implementation 'com.google.android.exoplayer:exoplayer-core:2.9.1'
|
|
implementation 'com.google.android.exoplayer:exoplayer-ui:2.9.1'
|
|
|
|
implementation 'org.conscrypt:conscrypt-android:2.0.0'
|
|
implementation 'org.signal:aesgcmprovider:0.0.3'
|
|
|
|
implementation 'org.whispersystems:signal-service-android:2.14.0'
|
|
|
|
implementation 'org.signal:ringrtc-android:0.1.8'
|
|
|
|
implementation "me.leolin:ShortcutBadger:1.1.16"
|
|
implementation 'se.emilsjolander:stickylistheaders:2.7.0'
|
|
implementation 'com.jpardogo.materialtabstrip:library:1.0.9'
|
|
implementation 'org.apache.httpcomponents:httpclient-android:4.3.5'
|
|
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
|
|
implementation 'com.github.bumptech.glide:glide:4.9.0'
|
|
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
|
|
annotationProcessor 'androidx.annotation:annotation:1.1.0'
|
|
implementation 'com.makeramen:roundedimageview:2.1.0'
|
|
implementation 'com.pnikosis:materialish-progress:1.5'
|
|
implementation 'org.greenrobot:eventbus:3.0.0'
|
|
implementation 'pl.tajchert:waitingdots:0.1.0'
|
|
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
|
implementation 'com.melnykov:floatingactionbutton:1.3.0'
|
|
implementation 'com.google.zxing:android-integration:3.1.0'
|
|
implementation 'mobi.upod:time-duration-picker:1.1.3'
|
|
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
|
|
implementation 'com.google.zxing:core:3.2.1'
|
|
implementation ('com.davemorrissey.labs:subsampling-scale-image-view:3.6.0') {
|
|
exclude group: 'com.android.support', module: 'support-annotations'
|
|
}
|
|
implementation ('cn.carbswang.android:NumberPickerView:1.0.9') {
|
|
exclude group: 'com.android.support', module: 'appcompat-v7'
|
|
}
|
|
implementation ('com.tomergoldst.android:tooltips:1.0.6') {
|
|
exclude group: 'com.android.support', module: 'appcompat-v7'
|
|
}
|
|
implementation ('com.klinkerapps:android-smsmms:4.0.1') {
|
|
exclude group: 'com.squareup.okhttp', module: 'okhttp'
|
|
exclude group: 'com.squareup.okhttp', module: 'okhttp-urlconnection'
|
|
}
|
|
implementation 'com.annimon:stream:1.1.8'
|
|
implementation ('com.takisoft.fix:colorpicker:0.9.1') {
|
|
exclude group: 'com.android.support', module: 'appcompat-v7'
|
|
exclude group: 'com.android.support', module: 'recyclerview-v7'
|
|
}
|
|
|
|
implementation 'com.airbnb.android:lottie:3.0.7'
|
|
|
|
implementation 'com.codewaves.stickyheadergrid:stickyheadergrid:0.9.4'
|
|
implementation 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3-S2'
|
|
implementation 'org.signal:android-database-sqlcipher:3.5.9-S3'
|
|
implementation ('com.googlecode.ez-vcard:ez-vcard:0.9.11') {
|
|
exclude group: 'com.fasterxml.jackson.core'
|
|
exclude group: 'org.freemarker'
|
|
}
|
|
|
|
testImplementation 'junit:junit:4.12'
|
|
testImplementation 'org.assertj:assertj-core:3.11.1'
|
|
testImplementation 'org.mockito:mockito-core:1.9.5'
|
|
testImplementation 'org.powermock:powermock-api-mockito:1.6.1'
|
|
testImplementation 'org.powermock:powermock-module-junit4:1.6.1'
|
|
testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.1'
|
|
testImplementation 'org.powermock:powermock-classloading-xstream:1.6.1'
|
|
|
|
testImplementation 'androidx.test:core:1.2.0'
|
|
androidTestImplementation 'androidx.multidex:multidex:2.0.1'
|
|
androidTestImplementation 'androidx.multidex:multidex-instrumentation:2.0.0'
|
|
androidTestImplementation 'com.google.dexmaker:dexmaker:1.2'
|
|
androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2'
|
|
androidTestImplementation ('org.assertj:assertj-core:1.7.1') {
|
|
exclude group: 'org.hamcrest', module: 'hamcrest-core'
|
|
}
|
|
androidTestImplementation ('com.squareup.assertj:assertj-android:1.1.1') {
|
|
exclude group: 'org.hamcrest', module: 'hamcrest-core'
|
|
exclude group: 'com.android.support', module: 'support-annotations'
|
|
}
|
|
testImplementation 'org.robolectric:robolectric:4.2'
|
|
testImplementation 'org.robolectric:shadows-multidex:4.2'
|
|
}
|
|
|
|
dependencyVerification {
|
|
configuration = '(play|website)(Debug|Release)RuntimeClasspath'
|
|
}
|
|
|
|
def canonicalVersionCode = 565
|
|
def canonicalVersionName = "4.49.18"
|
|
|
|
def postFixSize = 10
|
|
def abiPostFix = ['universal' : 0,
|
|
'armeabi-v7a' : 1,
|
|
'arm64-v8a' : 2,
|
|
'x86' : 3,
|
|
'x86_64' : 4]
|
|
|
|
android {
|
|
flavorDimensions "none"
|
|
compileSdkVersion 28
|
|
buildToolsVersion '28.0.3'
|
|
useLibrary 'org.apache.http.legacy'
|
|
|
|
dexOptions {
|
|
javaMaxHeapSize "4g"
|
|
}
|
|
|
|
defaultConfig {
|
|
versionCode canonicalVersionCode * postFixSize
|
|
versionName canonicalVersionName
|
|
|
|
minSdkVersion 19
|
|
targetSdkVersion 28
|
|
multiDexEnabled true
|
|
|
|
vectorDrawables.useSupportLibrary = true
|
|
project.ext.set("archivesBaseName", "Signal");
|
|
|
|
buildConfigField "long", "BUILD_TIMESTAMP", getLastCommitTimestamp() + "L"
|
|
buildConfigField "String", "SIGNAL_URL", "\"https://textsecure-service.whispersystems.org\""
|
|
buildConfigField "String", "SIGNAL_CDN_URL", "\"https://cdn.signal.org\""
|
|
buildConfigField "String", "SIGNAL_CONTACT_DISCOVERY_URL", "\"https://api.directory.signal.org\""
|
|
buildConfigField "String", "SIGNAL_SERVICE_STATUS_URL", "\"uptime.signal.org\""
|
|
buildConfigField "String", "CONTENT_PROXY_HOST", "\"contentproxy.signal.org\""
|
|
buildConfigField "int", "CONTENT_PROXY_PORT", "443"
|
|
buildConfigField "String", "USER_AGENT", "\"OWA\""
|
|
buildConfigField "boolean", "DEV_BUILD", "false"
|
|
buildConfigField "String", "MRENCLAVE", "\"cd6cfc342937b23b1bdd3bbf9721aa5615ac9ff50a75c5527d441cd3276826c9\""
|
|
buildConfigField "String", "UNIDENTIFIED_SENDER_TRUST_ROOT", "\"BXu6QIKVz5MA8gstzfOgRQGqyLqOwNKHL6INkv3IHWMF\""
|
|
buildConfigField "String[]", "LANGUAGES", "new String[]{\"" + autoResConfig().collect { s -> s.replace('-r', '_') }.join('", "') + '"}'
|
|
buildConfigField "int", "CANONICAL_VERSION_CODE", "$canonicalVersionCode"
|
|
|
|
ndk {
|
|
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
|
}
|
|
|
|
resConfigs autoResConfig()
|
|
|
|
splits {
|
|
abi {
|
|
enable true
|
|
reset()
|
|
include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
|
universalApk true
|
|
}
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
packagingOptions {
|
|
exclude 'LICENSE.txt'
|
|
exclude 'LICENSE'
|
|
exclude 'NOTICE'
|
|
exclude 'asm-license.txt'
|
|
exclude 'META-INF/LICENSE'
|
|
exclude 'META-INF/NOTICE'
|
|
exclude 'META-INF/proguard/androidx-annotations.pro'
|
|
}
|
|
|
|
buildTypes {
|
|
debug {
|
|
minifyEnabled true
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'),
|
|
'proguard-firebase-messaging.pro',
|
|
'proguard-google-play-services.pro',
|
|
'proguard-jackson.pro',
|
|
'proguard-sqlite.pro',
|
|
'proguard-appcompat-v7.pro',
|
|
'proguard-square-okhttp.pro',
|
|
'proguard-square-okio.pro',
|
|
'proguard-spongycastle.pro',
|
|
'proguard-rounded-image-view.pro',
|
|
'proguard-glide.pro',
|
|
'proguard-shortcutbadger.pro',
|
|
'proguard-retrofit.pro',
|
|
'proguard-webrtc.pro',
|
|
'proguard-klinker.pro',
|
|
'proguard-retrolambda.pro',
|
|
'proguard-okhttp.pro',
|
|
'proguard-ez-vcard.pro',
|
|
'proguard.cfg'
|
|
testProguardFiles 'proguard-automation.pro',
|
|
'proguard.cfg'
|
|
}
|
|
staging {
|
|
initWith debug
|
|
|
|
buildConfigField "String", "SIGNAL_URL", "\"https://textsecure-service-staging.whispersystems.org\""
|
|
buildConfigField "String", "SIGNAL_CDN_URL", "\"https://cdn-staging.signal.org\""
|
|
buildConfigField "String", "SIGNAL_CONTACT_DISCOVERY_URL", "\"https://api-staging.directory.signal.org\""
|
|
buildConfigField "String", "MRENCLAVE", "\"ba4ebb438bc07713819ee6c98d94037747006d7df63fc9e44d2d6f1fec962a79\""
|
|
buildConfigField "String", "UNIDENTIFIED_SENDER_TRUST_ROOT", "\"BbqY1DzohE4NUZoVF+L18oUPrK3kILllLEJh2UnPSsEx\""
|
|
}
|
|
release {
|
|
minifyEnabled true
|
|
proguardFiles = buildTypes.debug.proguardFiles
|
|
}
|
|
}
|
|
|
|
productFlavors {
|
|
play {
|
|
dimension "none"
|
|
ext.websiteUpdateUrl = "null"
|
|
buildConfigField "boolean", "PLAY_STORE_DISABLED", "false"
|
|
buildConfigField "String", "NOPLAY_UPDATE_URL", "$ext.websiteUpdateUrl"
|
|
}
|
|
|
|
website {
|
|
dimension "none"
|
|
ext.websiteUpdateUrl = "https://updates.signal.org/android"
|
|
buildConfigField "boolean", "PLAY_STORE_DISABLED", "true"
|
|
buildConfigField "String", "NOPLAY_UPDATE_URL", "\"$ext.websiteUpdateUrl\""
|
|
}
|
|
}
|
|
|
|
android.applicationVariants.all { variant ->
|
|
variant.outputs.each { output ->
|
|
output.outputFileName = output.outputFileName.replace(".apk", "-${variant.versionName}.apk")
|
|
def abiName = output.getFilter("ABI") ?: 'universal'
|
|
def postFix = abiPostFix.get(abiName, 0)
|
|
|
|
if (postFix >= postFixSize) throw new AssertionError("postFix is too large")
|
|
|
|
output.versionCodeOverride = canonicalVersionCode * postFixSize + postFix
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
manifest.srcFile 'AndroidManifest.xml'
|
|
java.srcDirs = ['src']
|
|
resources.srcDirs = ['src']
|
|
aidl.srcDirs = ['src']
|
|
renderscript.srcDirs = ['src']
|
|
res.srcDirs = ['res']
|
|
assets.srcDirs = ['assets']
|
|
jniLibs.srcDirs = ['libs']
|
|
}
|
|
androidTest {
|
|
java.srcDirs = ['test/androidTest/java']
|
|
}
|
|
test {
|
|
java.srcDirs = ['test/unitTest/java']
|
|
resources.srcDirs = ['test/unitTest/resources']
|
|
}
|
|
|
|
website.manifest.srcFile 'website/AndroidManifest.xml'
|
|
}
|
|
|
|
lintOptions {
|
|
abortOnError true
|
|
baseline file("lint-baseline.xml")
|
|
disable "LintError"
|
|
}
|
|
|
|
testOptions {
|
|
unitTests {
|
|
includeAndroidResources = true
|
|
}
|
|
}
|
|
}
|
|
|
|
def assembleWebsiteDescriptor = { variant, file ->
|
|
if (file.exists()) {
|
|
MessageDigest md = MessageDigest.getInstance("SHA-256");
|
|
file.eachByte 4096, {bytes, size ->
|
|
md.update(bytes, 0, size);
|
|
}
|
|
|
|
String digest = md.digest().collect {String.format "%02x", it}.join();
|
|
String url = variant.productFlavors.get(0).ext.websiteUpdateUrl
|
|
String apkName = file.getName()
|
|
|
|
String descriptor = "{" +
|
|
"\"versionCode\" : ${canonicalVersionCode * postFixSize + abiPostFix['universal']}," +
|
|
"\"versionName\" : \"$canonicalVersionName\"," +
|
|
"\"sha256sum\" : \"$digest\"," +
|
|
"\"url\" : \"$url/$apkName\"" +
|
|
"}"
|
|
|
|
File descriptorFile = new File(file.getParent(), apkName.replace(".apk", ".json"))
|
|
|
|
descriptorFile.write(descriptor)
|
|
}
|
|
}
|
|
|
|
def signProductionRelease = { variant ->
|
|
variant.outputs.collect { output ->
|
|
String apkName = output.outputFile.name
|
|
File inputFile = new File(output.outputFile.path)
|
|
File outputFile = new File(output.outputFile.parent, apkName.replace('-unsigned', ''))
|
|
|
|
new ApkSignerUtil('sun.security.pkcs11.SunPKCS11',
|
|
'pkcs11.config',
|
|
'PKCS11',
|
|
'file:pkcs11.password').calculateSignature(inputFile.getAbsolutePath(),
|
|
outputFile.getAbsolutePath())
|
|
|
|
inputFile.delete()
|
|
outputFile
|
|
}
|
|
}
|
|
|
|
task signProductionPlayRelease {
|
|
doLast {
|
|
signProductionRelease(android.applicationVariants.find { (it.name == 'playRelease') })
|
|
}
|
|
}
|
|
|
|
task signProductionWebsiteRelease {
|
|
doLast {
|
|
def variant = android.applicationVariants.find { (it.name == 'websiteRelease') }
|
|
File signedRelease = signProductionRelease(variant).find { it.name.contains('universal') }
|
|
assembleWebsiteDescriptor(variant, signedRelease)
|
|
}
|
|
}
|
|
|
|
tasks.whenTaskAdded { task ->
|
|
if (task.name.equals("assemblePlayRelease")) {
|
|
task.finalizedBy signProductionPlayRelease
|
|
}
|
|
|
|
if (task.name.equals("assembleWebsiteRelease")) {
|
|
task.finalizedBy signProductionWebsiteRelease
|
|
}
|
|
}
|
|
|
|
def getLastCommitTimestamp() {
|
|
new ByteArrayOutputStream().withStream { os ->
|
|
def result = exec {
|
|
executable = 'git'
|
|
args = ['log', '-1', '--pretty=format:%ct']
|
|
standardOutput = os
|
|
}
|
|
|
|
return os.toString() + "000"
|
|
}
|
|
}
|
|
|
|
task qa {
|
|
group 'Verification'
|
|
description 'Quality Assurance. Run before pushing.'
|
|
dependsOn ':testPlayReleaseUnitTest', ':lintPlayRelease', ':assemblePlayDebug'
|
|
}
|
|
|
|
wrapper {
|
|
distributionType = Wrapper.DistributionType.ALL
|
|
}
|