2022-12-08 12:57:35 -04:00
import com.android.build.api.dsl.ManagedVirtualDevice
2023-02-13 17:03:08 -05:00
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'androidx.navigation.safeargs'
id 'org.jlleitschuh.gradle.ktlint'
id 'org.jetbrains.kotlin.android'
id 'app.cash.exhaustive'
id 'kotlin-parcelize'
id 'com.squareup.wire'
2023-02-25 11:06:51 -05:00
id 'translations'
2023-09-08 16:29:31 -04:00
id 'licenses'
2023-02-13 17:03:08 -05:00
}
2022-03-02 14:32:24 -05:00
apply from: 'static-ips.gradle'
2013-10-10 13:52:24 -07:00
2023-02-02 10:10:00 -05:00
wire {
kotlin {
javaInterop = true
}
sourcePath {
srcDir 'src/main/protowire'
}
2023-08-23 13:15:45 -04:00
protoPath {
2023-10-06 11:34:51 -04:00
srcDir "${project.rootDir}/libsignal-service/src/main/protowire"
2023-08-23 13:15:45 -04:00
}
2023-02-02 10:10:00 -05:00
}
2022-01-12 12:04:07 -05:00
ktlint {
2023-06-23 13:09:24 -04:00
version = "0.49.1"
2022-01-12 12:04:07 -05:00
}
2023-11-02 19:00:09 -04:00
def canonicalVersionCode = 1355
def canonicalVersionName = "6.39.1"
2019-05-28 19:57:06 -03:00
2021-01-09 14:47:31 -05:00
def postFixSize = 100
2019-09-30 11:04:12 -04:00
def abiPostFix = [ 'universal' : 0 ,
'armeabi-v7a' : 1 ,
2019-05-28 19:57:06 -03:00
'arm64-v8a' : 2 ,
'x86' : 3 ,
2019-09-30 11:04:12 -04:00
'x86_64' : 4 ]
2019-05-01 09:00:26 -07:00
2020-11-02 17:31:32 -04:00
def keystores = [ 'debug' : loadKeystoreProperties ( 'keystore.debug.properties' ) ]
2020-11-02 08:18:50 -05:00
2021-08-19 12:57:23 -04:00
def selectableVariants = [
2022-02-14 14:18:03 -05:00
'nightlyProdSpinner' ,
2021-08-19 12:57:23 -04:00
'nightlyProdPerf' ,
'nightlyProdRelease' ,
2023-02-08 15:48:31 -05:00
'nightlyStagingRelease' ,
'nightlyPnpPerf' ,
'nightlyPnpRelease' ,
2021-08-19 12:57:23 -04:00
'playProdDebug' ,
2022-02-14 14:18:03 -05:00
'playProdSpinner' ,
2023-04-08 12:00:45 -04:00
'playProdCanary' ,
2021-08-19 12:57:23 -04:00
'playProdPerf' ,
2023-03-09 14:27:03 -05:00
'playProdBenchmark' ,
2022-07-15 12:49:12 -03:00
'playProdInstrumentation' ,
2021-08-19 12:57:23 -04:00
'playProdRelease' ,
'playStagingDebug' ,
2023-04-08 12:00:45 -04:00
'playStagingCanary' ,
2022-02-14 14:18:03 -05:00
'playStagingSpinner' ,
2021-08-19 12:57:23 -04:00
'playStagingPerf' ,
2022-07-15 12:49:12 -03:00
'playStagingInstrumentation' ,
2023-02-08 15:48:31 -05:00
'playPnpDebug' ,
'playPnpSpinner' ,
2021-08-19 12:57:23 -04:00
'playStagingRelease' ,
2022-02-14 14:18:03 -05:00
'websiteProdSpinner' ,
2021-08-19 12:57:23 -04:00
'websiteProdRelease' ,
]
2013-10-10 13:52:24 -07:00
android {
2023-02-11 15:35:01 -05:00
namespace 'org.thoughtcrime.securesms'
2023-02-27 19:44:51 -05:00
buildToolsVersion = signalBuildToolsVersion
compileSdkVersion = signalCompileSdkVersion
2020-12-03 13:19:03 -05:00
2020-11-02 17:31:32 -04:00
flavorDimensions 'distribution' , 'environment'
2016-12-11 13:37:22 -08:00
useLibrary 'org.apache.http.legacy'
2022-07-15 12:49:12 -03:00
testBuildType 'instrumentation'
2013-10-10 13:52:24 -07:00
2021-04-28 15:22:13 -04:00
kotlinOptions {
2023-08-16 15:29:45 -03:00
jvmTarget = signalKotlinJvmTarget
2021-04-28 15:22:13 -04:00
freeCompilerArgs = [ "-Xallow-result-return-type" ]
}
2020-09-18 16:52:11 -03:00
signingConfigs {
2020-11-02 17:31:32 -04:00
if ( keystores . debug ! = null ) {
2020-11-02 08:18:50 -05:00
debug {
2020-11-02 17:31:32 -04:00
storeFile file ( "${project.rootDir}/${keystores.debug.storeFile}" )
storePassword keystores . debug . storePassword
keyAlias keystores . debug . keyAlias
keyPassword keystores . debug . keyPassword
2020-11-02 08:18:50 -05:00
}
2020-09-18 16:52:11 -03:00
}
}
2022-02-17 15:55:54 -05:00
testOptions {
execution 'ANDROIDX_TEST_ORCHESTRATOR'
unitTests {
includeAndroidResources = true
}
2022-12-07 19:47:05 -05:00
managedDevices {
devices {
2022-12-08 12:57:35 -04:00
pixel3api30 ( ManagedVirtualDevice ) {
2022-12-07 19:47:05 -05:00
device = "Pixel 3"
apiLevel = 30
systemImageSource = "google-atd"
require64Bit = false
}
}
}
2022-02-17 15:55:54 -05:00
}
sourceSets {
test {
java . srcDirs + = "$projectDir/src/testShared"
}
androidTest {
java . srcDirs + = "$projectDir/src/testShared"
}
}
compileOptions {
coreLibraryDesugaringEnabled true
2023-02-27 19:44:51 -05:00
sourceCompatibility signalJavaVersion
targetCompatibility signalJavaVersion
2022-02-17 15:55:54 -05:00
}
2023-02-27 19:44:51 -05:00
2022-02-17 15:55:54 -05:00
packagingOptions {
2023-02-11 15:35:01 -05:00
resources {
2023-03-03 11:42:30 -05:00
excludes + = [ 'LICENSE.txt' , 'LICENSE' , 'NOTICE' , 'asm-license.txt' , 'META-INF/LICENSE' , 'META-INF/LICENSE.md' , 'META-INF/NOTICE' , 'META-INF/LICENSE-notice.md' , 'META-INF/proguard/androidx-annotations.pro' , 'libsignal_jni.dylib' , 'signal_jni.dll' ]
2023-02-11 15:35:01 -05:00
}
2022-02-17 15:55:54 -05:00
}
2023-02-11 15:35:01 -05:00
2022-08-09 13:29:04 -03:00
buildFeatures {
viewBinding true
2023-02-02 14:01:38 -04:00
compose true
}
composeOptions {
2023-06-20 14:49:00 -04:00
kotlinCompilerExtensionVersion = '1.4.4'
2022-08-09 13:29:04 -03:00
}
2022-02-17 15:55:54 -05:00
2013-10-10 13:52:24 -07:00
defaultConfig {
2019-05-28 19:57:06 -03:00
versionCode canonicalVersionCode * postFixSize
versionName canonicalVersionName
2017-02-26 14:36:43 -08:00
2023-02-27 19:44:51 -05:00
minSdkVersion signalMinSdkVersion
targetSdkVersion signalTargetSdkVersion
2020-12-03 13:19:03 -05:00
2017-01-08 09:43:43 -08:00
multiDexEnabled true
2015-01-11 20:27:34 -08:00
2016-11-21 18:58:10 -08:00
vectorDrawables . useSupportLibrary = true
2022-12-08 12:57:35 -04:00
project . ext . set ( "archivesBaseName" , "Signal" )
2016-11-21 18:58:10 -08:00
2022-08-04 13:21:11 -04:00
manifestPlaceholders = [ mapsKey: "AIzaSyCSx9xea86GwDKGznCAULE9Y5a8b-TfN9U" ]
2016-02-17 11:27:35 -08:00
buildConfigField "long" , "BUILD_TIMESTAMP" , getLastCommitTimestamp ( ) + "L"
2021-02-05 15:18:11 -05:00
buildConfigField "String" , "GIT_HASH" , "\"${getGitHash()}\""
2021-12-07 14:10:18 -06:00
buildConfigField "String" , "SIGNAL_URL" , "\"https://chat.signal.org\""
2019-09-26 10:12:51 -04:00
buildConfigField "String" , "STORAGE_URL" , "\"https://storage.signal.org\""
2017-08-08 16:37:15 -07:00
buildConfigField "String" , "SIGNAL_CDN_URL" , "\"https://cdn.signal.org\""
2020-04-05 17:32:06 -07:00
buildConfigField "String" , "SIGNAL_CDN2_URL" , "\"https://cdn2.signal.org\""
2023-08-30 19:43:20 -04:00
buildConfigField "String" , "SIGNAL_CDN3_URL" , "\"https://cdn3.signal.org\""
2022-08-10 11:06:21 -04:00
buildConfigField "String" , "SIGNAL_CDSI_URL" , "\"https://cdsi.signal.org\""
2018-06-11 09:37:01 -07:00
buildConfigField "String" , "SIGNAL_SERVICE_STATUS_URL" , "\"uptime.signal.org\""
2019-12-03 12:31:23 -05:00
buildConfigField "String" , "SIGNAL_KEY_BACKUP_URL" , "\"https://api.backup.signal.org\""
2023-05-24 13:47:29 -07:00
buildConfigField "String" , "SIGNAL_SVR2_URL" , "\"https://svr2.signal.org\""
2020-11-20 15:42:46 -05:00
buildConfigField "String" , "SIGNAL_SFU_URL" , "\"https://sfu.voip.signal.org\""
2022-11-18 13:50:03 -05:00
buildConfigField "String" , "SIGNAL_STAGING_SFU_URL" , "\"https://sfu.staging.voip.signal.org\""
2022-10-25 10:18:15 -04:00
buildConfigField "String[]" , "SIGNAL_SFU_INTERNAL_NAMES" , "new String[]{\"Test\", \"Staging\", \"Development\"}"
buildConfigField "String[]" , "SIGNAL_SFU_INTERNAL_URLS" , "new String[]{\"https://sfu.test.voip.signal.org\", \"https://sfu.staging.voip.signal.org\", \"https://sfu.staging.test.voip.signal.org\"}"
2019-01-15 00:41:05 -08:00
buildConfigField "String" , "CONTENT_PROXY_HOST" , "\"contentproxy.signal.org\""
buildConfigField "int" , "CONTENT_PROXY_PORT" , "443"
2022-03-02 14:32:24 -05:00
buildConfigField "String[]" , "SIGNAL_SERVICE_IPS" , service_ips
buildConfigField "String[]" , "SIGNAL_STORAGE_IPS" , storage_ips
buildConfigField "String[]" , "SIGNAL_CDN_IPS" , cdn_ips
buildConfigField "String[]" , "SIGNAL_CDN2_IPS" , cdn2_ips
2023-08-30 19:43:20 -04:00
buildConfigField "String[]" , "SIGNAL_CDN3_IPS" , cdn3_ips
2022-03-02 14:32:24 -05:00
buildConfigField "String[]" , "SIGNAL_SFU_IPS" , sfu_ips
buildConfigField "String[]" , "SIGNAL_CONTENT_PROXY_IPS" , content_proxy_ips
2023-06-23 11:16:32 -04:00
buildConfigField "String[]" , "SIGNAL_CDSI_IPS" , cdsi_ips
buildConfigField "String[]" , "SIGNAL_SVR2_IPS" , svr2_ips
2020-01-23 11:28:17 -05:00
buildConfigField "String" , "SIGNAL_AGENT" , "\"OWA\""
2023-02-14 14:28:22 -05:00
buildConfigField "String" , "CDSI_MRENCLAVE" , "\"0f6fd79cdfdaa5b2e6337f534d3baf999318b0c462a7ac1f41297a3e4b424a57\""
2023-05-24 13:47:29 -07:00
buildConfigField "String" , "SVR2_MRENCLAVE" , "\"6ee1042f9e20f880326686dd4ba50c25359f01e9f733eeba4382bca001d45094\""
2018-10-11 16:45:22 -07:00
buildConfigField "String" , "UNIDENTIFIED_SENDER_TRUST_ROOT" , "\"BXu6QIKVz5MA8gstzfOgRQGqyLqOwNKHL6INkv3IHWMF\""
2022-07-11 15:20:00 -04:00
buildConfigField "String" , "ZKGROUP_SERVER_PUBLIC_PARAMS" , "\"AMhf5ywVwITZMsff/eCyudZx9JDmkkkbV6PInzG4p8x3VqVJSFiMvnvlEKWuRob/1eaIetR31IYeAbm0NdOuHH8Qi+Rexi1wLlpzIo1gstHWBfZzy1+qHRV5A4TqPp15YzBPm0WSggW6PbSn+F4lf57VCnHF7p8SvzAA2ZZJPYJURt8X7bbg+H3i+PEjH9DXItNEqs2sNcug37xZQDLm7X36nOoGPs54XsEGzPdEV+itQNGUFEjY6X9Uv+Acuks7NpyGvCoKxGwgKgE5XyJ+nNKlyHHOLb6N1NuHyBrZrgtY/JYJHRooo5CEqYKBqdFnmbTVGEkCvJKxLnjwKWf+fEPoWeQFj5ObDjcKMZf2Jm2Ae69x+ikU5gBXsRmoF94GXTLfN0/vLt98KDPnxwAQL9j5V1jGOY8jQl6MLxEs56cwXN0dqCnImzVH3TZT1cJ8SW1BRX6qIVxEzjsSGx3yxF3suAilPMqGRp4ffyopjMD1JXiKR2RwLKzizUe5e8XyGOy9fplzhw3jVzTRyUZTRSZKkMLWcQ/gv0E4aONNqs4P\""
2023-05-19 10:28:29 -03:00
buildConfigField "String" , "GENERIC_SERVER_PUBLIC_PARAMS" , "\"AByD873dTilmOSG0TjKrvpeaKEsUmIO8Vx9BeMmftwUs9v7ikPwM8P3OHyT0+X3EUMZrSe9VUp26Wai51Q9I8mdk0hX/yo7CeFGJyzoOqn8e/i4Ygbn5HoAyXJx5eXfIbqpc0bIxzju4H/HOQeOpt6h742qii5u/cbwOhFZCsMIbElZTaeU+BWMBQiZHIGHT5IE0qCordQKZ5iPZom0HeFa8Yq0ShuEyAl0WINBiY6xE3H/9WnvzXBbMuuk//eRxXgzO8ieCeK8FwQNxbfXqZm6Ro1cMhCOF3u7xoX83QhpN\""
2019-03-14 13:33:43 -03:00
buildConfigField "String[]" , "LANGUAGES" , "new String[]{\"" + autoResConfig ( ) . collect { s - > s . replace ( '-r' , '_' ) } . join ( '", "' ) + '"}'
2019-05-28 19:57:06 -03:00
buildConfigField "int" , "CANONICAL_VERSION_CODE" , "$canonicalVersionCode"
2021-04-06 13:03:33 -03:00
buildConfigField "String" , "DEFAULT_CURRENCIES" , "\"EUR,AUD,GBP,CAD,CNY\""
2021-05-05 09:59:05 -03:00
buildConfigField "String" , "GIPHY_API_KEY" , "\"3o6ZsYH6U6Eri53TXy\""
2022-03-03 10:43:51 -08:00
buildConfigField "String" , "SIGNAL_CAPTCHA_URL" , "\"https://signalcaptchas.org/registration/generate.html\""
2021-05-05 12:49:18 -04:00
buildConfigField "String" , "RECAPTCHA_PROOF_URL" , "\"https://signalcaptchas.org/challenge/generate.html\""
2018-02-02 16:31:49 -08:00
2021-06-16 00:55:24 -04:00
buildConfigField "String" , "BUILD_DISTRIBUTION_TYPE" , "\"unset\""
buildConfigField "String" , "BUILD_ENVIRONMENT_TYPE" , "\"unset\""
buildConfigField "String" , "BUILD_VARIANT_TYPE" , "\"unset\""
2021-09-28 16:55:07 -03:00
buildConfigField "String" , "BADGE_STATIC_ROOT" , "\"https://updates2.signal.org/static/badges/\""
2021-10-21 16:39:02 -03:00
buildConfigField "String" , "STRIPE_PUBLISHABLE_KEY" , "\"pk_live_6cmGZopuTsV8novGgJJW9JpC00vLIgtQ1D\""
2023-03-09 14:27:03 -05:00
buildConfigField "boolean" , "TRACING_ENABLED" , "false"
2021-06-16 00:55:24 -04:00
2018-02-02 16:31:49 -08:00
ndk {
2019-05-28 19:57:06 -03:00
abiFilters 'armeabi-v7a' , 'arm64-v8a' , 'x86' , 'x86_64'
2018-02-02 16:31:49 -08:00
}
2023-06-30 11:21:03 -03:00
resourceConfigurations + = [ ]
2019-03-14 13:33:43 -03:00
2019-03-28 17:21:57 -03:00
splits {
abi {
2023-03-09 14:27:03 -05:00
enable ! project . hasProperty ( 'generateBaselineProfile' )
2019-03-28 17:21:57 -03:00
reset ( )
2019-05-28 19:57:06 -03:00
include 'armeabi-v7a' , 'arm64-v8a' , 'x86' , 'x86_64'
2019-03-28 17:21:57 -03:00
universalApk true
}
}
2020-01-22 15:02:06 -05:00
2022-08-03 11:50:16 -04:00
testInstrumentationRunner "org.thoughtcrime.securesms.testing.SignalTestRunner"
2021-10-15 10:18:38 -04:00
testInstrumentationRunnerArguments clearPackageData: 'true'
}
2013-10-10 13:52:24 -07:00
buildTypes {
2015-01-11 20:27:34 -08:00
debug {
2020-11-02 08:18:50 -05:00
if ( keystores [ 'debug' ] ! = null ) {
signingConfig signingConfigs . debug
}
2020-11-02 17:31:32 -04:00
isDefault true
2022-01-10 10:13:23 -05:00
minifyEnabled false
2015-04-01 18:04:23 -07:00
proguardFiles getDefaultProguardFile ( 'proguard-android.txt' ) ,
2019-11-20 12:33:57 -05:00
'proguard/proguard-firebase-messaging.pro' ,
'proguard/proguard-google-play-services.pro' ,
'proguard/proguard-jackson.pro' ,
'proguard/proguard-sqlite.pro' ,
'proguard/proguard-appcompat-v7.pro' ,
'proguard/proguard-square-okhttp.pro' ,
'proguard/proguard-square-okio.pro' ,
'proguard/proguard-rounded-image-view.pro' ,
'proguard/proguard-glide.pro' ,
'proguard/proguard-shortcutbadger.pro' ,
'proguard/proguard-retrofit.pro' ,
'proguard/proguard-webrtc.pro' ,
'proguard/proguard-klinker.pro' ,
2023-01-17 06:37:45 -08:00
'proguard/proguard-mobilecoin.pro' ,
2019-11-20 12:33:57 -05:00
'proguard/proguard-retrolambda.pro' ,
'proguard/proguard-okhttp.pro' ,
'proguard/proguard-ez-vcard.pro' ,
'proguard/proguard.cfg'
testProguardFiles 'proguard/proguard-automation.pro' ,
'proguard/proguard.cfg'
2021-06-16 00:55:24 -04:00
2022-08-04 13:21:11 -04:00
manifestPlaceholders = [ mapsKey: getMapsKey ( ) ]
2021-06-16 00:55:24 -04:00
buildConfigField "String" , "BUILD_VARIANT_TYPE" , "\"Debug\""
2015-01-11 20:27:34 -08:00
}
2022-07-15 12:49:12 -03:00
instrumentation {
initWith debug
isDefault false
minifyEnabled false
matchingFallbacks = [ 'debug' ]
applicationIdSuffix ".instrumentation"
buildConfigField "String" , "BUILD_VARIANT_TYPE" , "\"Instrumentation\""
}
2022-02-14 14:18:03 -05:00
spinner {
2020-03-01 10:54:11 -05:00
initWith debug
2020-11-02 17:31:32 -04:00
isDefault false
2020-03-01 10:54:11 -05:00
minifyEnabled false
2020-12-03 13:19:03 -05:00
matchingFallbacks = [ 'debug' ]
2022-02-14 14:18:03 -05:00
buildConfigField "String" , "BUILD_VARIANT_TYPE" , "\"Spinner\""
2020-03-01 10:54:11 -05:00
}
2023-02-08 15:48:31 -05:00
2013-10-10 13:52:24 -07:00
release {
2015-01-20 21:26:58 -10:00
minifyEnabled true
2015-05-15 11:54:56 -07:00
proguardFiles = buildTypes . debug . proguardFiles
2021-06-16 00:55:24 -04:00
buildConfigField "String" , "BUILD_VARIANT_TYPE" , "\"Release\""
2013-10-10 13:52:24 -07:00
}
2023-02-08 15:48:31 -05:00
2020-12-20 13:28:55 -05:00
perf {
initWith debug
isDefault false
debuggable false
2022-01-10 10:13:23 -05:00
minifyEnabled true
2020-12-20 13:28:55 -05:00
matchingFallbacks = [ 'debug' ]
2021-06-16 00:55:24 -04:00
buildConfigField "String" , "BUILD_VARIANT_TYPE" , "\"Perf\""
2023-03-09 14:27:03 -05:00
buildConfigField "boolean" , "TRACING_ENABLED" , "true"
}
benchmark {
initWith debug
isDefault false
debuggable false
minifyEnabled true
matchingFallbacks = [ 'debug' ]
buildConfigField "String" , "BUILD_VARIANT_TYPE" , "\"Benchmark\""
buildConfigField "boolean" , "TRACING_ENABLED" , "true"
2020-12-20 13:28:55 -05:00
}
2023-04-08 12:00:45 -04:00
canary {
initWith debug
isDefault false
minifyEnabled false
matchingFallbacks = [ 'debug' ]
buildConfigField "String" , "BUILD_VARIANT_TYPE" , "\"Canary\""
}
2013-10-10 13:52:24 -07:00
}
2014-01-10 16:20:25 -10:00
2017-02-26 14:36:43 -08:00
productFlavors {
play {
2020-11-02 17:31:32 -04:00
dimension 'distribution'
isDefault true
2023-10-23 11:30:37 -07:00
buildConfigField "boolean" , "MANAGES_APP_UPDATES" , "false"
2023-10-27 14:27:17 -07:00
buildConfigField "String" , "APK_UPDATE_MANIFEST_URL" , "null"
2021-06-16 00:55:24 -04:00
buildConfigField "String" , "BUILD_DISTRIBUTION_TYPE" , "\"play\""
2017-02-26 14:36:43 -08:00
}
website {
2020-11-02 17:31:32 -04:00
dimension 'distribution'
2023-10-23 11:30:37 -07:00
buildConfigField "boolean" , "MANAGES_APP_UPDATES" , "true"
2023-10-27 14:27:17 -07:00
buildConfigField "String" , "APK_UPDATE_MANIFEST_URL" , "\"https://updates.signal.org/android/latest.json\""
2021-06-16 00:55:24 -04:00
buildConfigField "String" , "BUILD_DISTRIBUTION_TYPE" , "\"website\""
2017-02-26 14:36:43 -08:00
}
2020-10-29 15:33:15 -04:00
2021-07-08 09:25:35 -04:00
nightly {
2023-10-27 14:27:17 -07:00
def apkUpdateManifestUrl = "<unset>"
2023-11-01 22:05:37 -04:00
if ( file ( "${project.rootDir}/nightly-url.txt" ) . exists ( ) ) {
apkUpdateManifestUrl = file ( "${project.rootDir}/nightly-url.txt" ) . text . trim ( )
2023-10-27 14:27:17 -07:00
}
2021-07-08 09:25:35 -04:00
dimension 'distribution'
2021-07-09 18:49:32 -04:00
versionNameSuffix "-nightly-untagged-${getDateSuffix()}"
2023-10-27 14:27:17 -07:00
buildConfigField "boolean" , "MANAGES_APP_UPDATES" , "true"
buildConfigField "String" , "APK_UPDATE_MANIFEST_URL" , "\"${apkUpdateManifestUrl}\""
2021-07-26 11:16:24 -04:00
buildConfigField "String" , "BUILD_DISTRIBUTION_TYPE" , "\"nightly\""
2021-07-08 09:25:35 -04:00
}
2020-11-02 17:31:32 -04:00
prod {
dimension 'environment'
isDefault true
2021-04-06 13:03:33 -03:00
buildConfigField "String" , "MOBILE_COIN_ENVIRONMENT" , "\"mainnet\""
2021-06-16 00:55:24 -04:00
buildConfigField "String" , "BUILD_ENVIRONMENT_TYPE" , "\"Prod\""
2020-11-02 17:31:32 -04:00
}
staging {
dimension 'environment'
applicationIdSuffix ".staging"
2021-12-07 14:10:18 -06:00
buildConfigField "String" , "SIGNAL_URL" , "\"https://chat.staging.signal.org\""
2020-11-02 17:31:32 -04:00
buildConfigField "String" , "STORAGE_URL" , "\"https://storage-staging.signal.org\""
buildConfigField "String" , "SIGNAL_CDN_URL" , "\"https://cdn-staging.signal.org\""
buildConfigField "String" , "SIGNAL_CDN2_URL" , "\"https://cdn2-staging.signal.org\""
2023-08-30 19:43:20 -04:00
buildConfigField "String" , "SIGNAL_CDN3_URL" , "\"https://cdn3-staging.signal.org\""
2022-08-10 11:06:21 -04:00
buildConfigField "String" , "SIGNAL_CDSI_URL" , "\"https://cdsi.staging.signal.org\""
2020-11-02 17:31:32 -04:00
buildConfigField "String" , "SIGNAL_KEY_BACKUP_URL" , "\"https://api-staging.backup.signal.org\""
2023-05-24 13:47:29 -07:00
buildConfigField "String" , "SIGNAL_SVR2_URL" , "\"https://svr2.staging.signal.org\""
buildConfigField "String" , "SVR2_MRENCLAVE" , "\"a8a261420a6bb9b61aa25bf8a79e8bd20d7652531feb3381cbffd446d270be95\""
2020-11-02 17:31:32 -04:00
buildConfigField "String" , "UNIDENTIFIED_SENDER_TRUST_ROOT" , "\"BbqY1DzohE4NUZoVF+L18oUPrK3kILllLEJh2UnPSsEx\""
2022-07-11 15:20:00 -04:00
buildConfigField "String" , "ZKGROUP_SERVER_PUBLIC_PARAMS" , "\"ABSY21VckQcbSXVNCGRYJcfWHiAMZmpTtTELcDmxgdFbtp/bWsSxZdMKzfCp8rvIs8ocCU3B37fT3r4Mi5qAemeGeR2X+/YmOGR5ofui7tD5mDQfstAI9i+4WpMtIe8KC3wU5w3Inq3uNWVmoGtpKndsNfwJrCg0Hd9zmObhypUnSkfYn2ooMOOnBpfdanRtrvetZUayDMSC5iSRcXKpdlukrpzzsCIvEwjwQlJYVPOQPj4V0F4UXXBdHSLK05uoPBCQG8G9rYIGedYsClJXnbrgGYG3eMTG5hnx4X4ntARBgELuMWWUEEfSK0mjXg+/2lPmWcTZWR9nkqgQQP0tbzuiPm74H2wMO4u1Wafe+UwyIlIT9L7KLS19Aw8r4sPrXZSSsOZ6s7M1+rTJN0bI5CKY2PX29y5Ok3jSWufIKcgKOnWoP67d5b2du2ZVJjpjfibNIHbT/cegy/sBLoFwtHogVYUewANUAXIaMPyCLRArsKhfJ5wBtTminG/PAvuBdJ70Z/bXVPf8TVsR292zQ65xwvWTejROW6AZX6aqucUj\""
2023-05-19 10:28:29 -03:00
buildConfigField "String" , "GENERIC_SERVER_PUBLIC_PARAMS" , "\"AHILOIrFPXX9laLbalbA9+L1CXpSbM/bTJXZGZiuyK1JaI6dK5FHHWL6tWxmHKYAZTSYmElmJ5z2A5YcirjO/yfoemE03FItyaf8W1fE4p14hzb5qnrmfXUSiAIVrhaXVwIwSzH6RL/+EO8jFIjJ/YfExfJ8aBl48CKHgu1+A6kWynhttonvWWx6h7924mIzW0Czj2ROuh4LwQyZypex4GuOPW8sgIT21KNZaafgg+KbV7XM1x1tF3XA17B4uGUaDbDw2O+nR1+U5p6qHPzmJ7ggFjSN6Utu+35dS1sS0P9N\""
2021-04-06 13:03:33 -03:00
buildConfigField "String" , "MOBILE_COIN_ENVIRONMENT" , "\"testnet\""
2022-03-03 10:43:51 -08:00
buildConfigField "String" , "SIGNAL_CAPTCHA_URL" , "\"https://signalcaptchas.org/staging/registration/generate.html\""
2021-05-05 12:49:18 -04:00
buildConfigField "String" , "RECAPTCHA_PROOF_URL" , "\"https://signalcaptchas.org/staging/challenge/generate.html\""
2021-06-16 00:55:24 -04:00
buildConfigField "String" , "BUILD_ENVIRONMENT_TYPE" , "\"Staging\""
2021-10-21 16:39:02 -03:00
buildConfigField "String" , "STRIPE_PUBLISHABLE_KEY" , "\"pk_test_sngOd8FnXNkpce9nPXawKrJD00kIDngZkD\""
2020-11-02 17:31:32 -04:00
}
2023-02-08 15:48:31 -05:00
pnp {
dimension 'environment'
initWith staging
applicationIdSuffix ".pnp"
buildConfigField "String" , "BUILD_ENVIRONMENT_TYPE" , "\"Pnp\""
}
2017-02-26 14:36:43 -08:00
}
2023-02-11 15:35:01 -05:00
lint {
abortOnError true
baseline file ( 'lint-baseline.xml' )
checkReleaseBuilds false
disable 'LintError'
}
2017-11-06 09:20:52 -08:00
android . applicationVariants . all { variant - >
2019-05-28 19:57:06 -03:00
variant . outputs . each { output - >
2021-07-08 09:25:35 -04:00
if ( output . baseName . contains ( 'nightly' ) ) {
output . versionCodeOverride = canonicalVersionCode * postFixSize + 5
2021-07-09 18:49:32 -04:00
def tag = getCurrentGitTag ( )
if ( tag ! = null & & tag . length ( ) > 0 ) {
2022-02-09 09:07:01 -06:00
if ( tag . startsWith ( "v" ) ) {
tag = tag . substring ( 1 )
}
2021-07-09 18:49:32 -04:00
output . versionNameOverride = tag
2023-10-30 12:45:52 -04:00
output . outputFileName = output . outputFileName . replace ( ".apk" , "-${output.versionNameOverride}.apk" )
2023-10-27 14:27:17 -07:00
} else {
output . outputFileName = output . outputFileName . replace ( ".apk" , "-${variant.versionName}.apk" )
2021-07-09 18:49:32 -04:00
}
2021-07-08 09:25:35 -04:00
} else {
output . outputFileName = output . outputFileName . replace ( ".apk" , "-${variant.versionName}.apk" )
def abiName = output . getFilter ( "ABI" ) ? : 'universal'
def postFix = abiPostFix . get ( abiName , 0 )
2019-05-28 19:57:06 -03:00
2021-07-08 09:25:35 -04:00
if ( postFix > = postFixSize ) throw new AssertionError ( "postFix is too large" )
2019-05-28 19:57:06 -03:00
2021-07-08 09:25:35 -04:00
output . versionCodeOverride = canonicalVersionCode * postFixSize + postFix
}
2017-02-26 14:36:43 -08:00
}
}
2021-03-05 13:54:57 -05:00
android . variantFilter { variant - >
def distribution = variant . getFlavors ( ) . get ( 0 ) . name
def environment = variant . getFlavors ( ) . get ( 1 ) . name
def buildType = variant . buildType . name
2021-08-19 12:57:23 -04:00
def fullName = distribution + environment . capitalize ( ) + buildType . capitalize ( )
2021-03-05 13:54:57 -05:00
2021-08-19 12:57:23 -04:00
if ( ! selectableVariants . contains ( fullName ) ) {
2021-07-08 09:25:35 -04:00
variant . setIgnore ( true )
2021-03-05 13:54:57 -05:00
}
}
2023-06-27 14:31:59 -03:00
android . buildTypes . each {
if ( it . name ! = 'release' ) {
sourceSets . findByName ( it . name ) . java . srcDirs + = "$projectDir/src/debug/java"
} else {
sourceSets . findByName ( it . name ) . java . srcDirs + = "$projectDir/src/release/java"
}
}
2013-10-10 13:52:24 -07:00
}
2020-03-01 10:54:11 -05:00
dependencies {
2021-09-14 14:57:04 -03:00
implementation libs . androidx . fragment . ktx
2020-05-01 16:19:24 -03:00
lintChecks project ( ':lintchecks' )
2021-09-14 14:57:04 -03:00
coreLibraryDesugaring libs . android . tools . desugar
2021-04-06 19:54:18 -03:00
2021-09-14 14:57:04 -03:00
implementation ( libs . androidx . appcompat ) {
2021-09-14 09:01:42 -03:00
version {
2023-03-08 12:12:58 -04:00
strictly '1.6.1'
2021-09-14 09:01:42 -03:00
}
2020-05-18 12:30:03 -03:00
}
2022-09-13 11:16:01 -03:00
implementation libs . androidx . window . window
implementation libs . androidx . window . java
2021-09-14 14:57:04 -03:00
implementation libs . androidx . recyclerview
implementation libs . material . material
implementation libs . androidx . legacy . support
implementation libs . androidx . preference
implementation libs . androidx . legacy . preference
implementation libs . androidx . gridlayout
implementation libs . androidx . exifinterface
2023-05-22 15:35:19 -04:00
implementation libs . androidx . compose . rxjava3
2023-06-08 11:44:33 -03:00
implementation libs . androidx . compose . runtime . livedata
2021-09-14 14:57:04 -03:00
implementation libs . androidx . constraintlayout
implementation libs . androidx . multidex
implementation libs . androidx . navigation . fragment . ktx
implementation libs . androidx . navigation . ui . ktx
2022-09-13 11:16:01 -03:00
implementation libs . androidx . lifecycle . viewmodel . ktx
implementation libs . androidx . lifecycle . livedata . ktx
implementation libs . androidx . lifecycle . process
2021-09-14 14:57:04 -03:00
implementation libs . androidx . lifecycle . viewmodel . savedstate
implementation libs . androidx . lifecycle . common . java8
implementation libs . androidx . lifecycle . reactivestreams . ktx
implementation libs . androidx . camera . core
implementation libs . androidx . camera . camera2
implementation libs . androidx . camera . lifecycle
implementation libs . androidx . camera . view
implementation libs . androidx . concurrent . futures
implementation libs . androidx . autofill
implementation libs . androidx . biometric
implementation libs . androidx . sharetarget
2023-03-09 14:27:03 -05:00
implementation libs . androidx . profileinstaller
2023-03-23 14:40:48 -04:00
implementation libs . androidx . asynclayoutinflater
implementation libs . androidx . asynclayoutinflater . appcompat
2021-09-14 14:57:04 -03:00
implementation ( libs . firebase . messaging ) {
2020-03-01 10:54:11 -05:00
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'
}
2021-09-14 14:57:04 -03:00
implementation libs . google . play . services . maps
implementation libs . google . play . services . auth
2020-03-01 10:54:11 -05:00
2023-08-15 14:01:15 -04:00
implementation libs . bundles . media3
2020-03-01 10:54:11 -05:00
2021-09-14 14:57:04 -03:00
implementation libs . conscrypt . android
implementation libs . signal . aesgcmprovider
2020-03-01 10:54:11 -05:00
implementation project ( ':libsignal-service' )
2020-12-03 13:19:03 -05:00
implementation project ( ':paging' )
2020-12-04 18:31:58 -05:00
implementation project ( ':core-util' )
2021-12-10 15:31:46 -05:00
implementation project ( ':glide-config' )
2021-01-05 19:13:38 -04:00
implementation project ( ':video' )
2021-03-11 13:27:25 -05:00
implementation project ( ':device-transfer' )
2021-09-13 13:16:14 -03:00
implementation project ( ':image-editor' )
2021-10-12 15:55:54 -03:00
implementation project ( ':donations' )
2022-03-24 12:47:27 -04:00
implementation project ( ':contacts' )
2022-05-19 16:26:03 -04:00
implementation project ( ':qr' )
2022-08-30 15:22:40 -03:00
implementation project ( ':sms-exporter' )
2022-10-21 11:04:40 -04:00
implementation project ( ':sticky-header-grid' )
implementation project ( ':photoview' )
2023-09-22 12:55:49 -04:00
implementation project ( ':glide-webp' )
2021-01-05 19:13:38 -04:00
2022-03-24 13:23:23 -04:00
implementation libs . libsignal . android
2021-04-06 13:03:33 -03:00
2023-09-18 15:32:43 -04:00
implementation libs . mobilecoin
2021-04-06 13:03:33 -03:00
2021-09-14 14:57:04 -03:00
implementation libs . signal . ringrtc
implementation libs . leolin . shortcutbadger
implementation libs . emilsjolander . stickylistheaders
implementation libs . apache . httpclient . android
implementation libs . glide . glide
implementation libs . roundedimageview
implementation libs . materialish . progress
2023-10-19 13:11:13 -04:00
implementation libs . greenrobot . eventbus
2021-09-14 14:57:04 -03:00
implementation libs . google . zxing . android . integration
implementation libs . google . zxing . core
2022-10-21 11:04:40 -04:00
implementation libs . google . flexbox
2021-09-14 14:57:04 -03:00
implementation ( libs . subsampling . scale . image . view ) {
2020-03-01 10:54:11 -05:00
exclude group: 'com.android.support' , module: 'support-annotations'
}
2021-09-14 14:57:04 -03:00
implementation ( libs . android . tooltips ) {
2020-03-01 10:54:11 -05:00
exclude group: 'com.android.support' , module: 'appcompat-v7'
}
2021-09-14 14:57:04 -03:00
implementation ( libs . android . smsmms ) {
2020-03-01 10:54:11 -05:00
exclude group: 'com.squareup.okhttp' , module: 'okhttp'
exclude group: 'com.squareup.okhttp' , module: 'okhttp-urlconnection'
}
2021-09-14 14:57:04 -03:00
implementation libs . stream
2020-03-01 10:54:11 -05:00
2021-09-14 14:57:04 -03:00
implementation libs . lottie
2020-03-01 10:54:11 -05:00
2021-09-14 14:57:04 -03:00
implementation libs . signal . android . database . sqlcipher
implementation libs . androidx . sqlite
2021-05-06 12:32:25 -04:00
2021-09-14 14:57:04 -03:00
implementation ( libs . google . ez . vcard ) {
2020-03-01 10:54:11 -05:00
exclude group: 'com.fasterxml.jackson.core'
exclude group: 'org.freemarker'
}
2021-09-14 14:57:04 -03:00
implementation libs . dnsjava
2023-03-31 10:31:38 -04:00
implementation libs . kotlinx . collections . immutable
2023-04-03 09:56:44 -04:00
implementation libs . accompanist . permissions
2020-03-01 10:54:11 -05:00
2022-02-14 14:18:03 -05:00
spinnerImplementation project ( ":spinner" )
2023-04-08 12:00:45 -04:00
canaryImplementation libs . square . leakcanary
2020-03-01 10:54:11 -05:00
2021-09-14 14:57:04 -03:00
testImplementation testLibs . junit . junit
testImplementation testLibs . assertj . core
testImplementation testLibs . mockito . core
2022-03-14 20:49:40 -04:00
testImplementation testLibs . mockito . kotlin
2020-03-01 10:54:11 -05:00
2021-09-14 14:57:04 -03:00
testImplementation testLibs . androidx . test . core
testImplementation ( testLibs . robolectric . robolectric ) {
2020-02-28 13:03:06 -05:00
exclude group: 'com.google.protobuf' , module: 'protobuf-java'
}
2021-09-14 14:57:04 -03:00
testImplementation testLibs . robolectric . shadows . multidex
2023-06-20 14:49:00 -04:00
testImplementation ( testLibs . bouncycastle . bcprov . jdk15on ) { version { strictly "1.70" } } // Used by roboelectric
testImplementation ( testLibs . bouncycastle . bcpkix . jdk15on ) { version { strictly "1.70" } } // Used by roboelectric
2023-08-29 16:48:46 -03:00
testImplementation testLibs . conscrypt . openjdk . uber // Used by robolectric
2021-09-14 14:57:04 -03:00
testImplementation testLibs . hamcrest . hamcrest
2022-10-27 16:43:23 -04:00
testImplementation testLibs . mockk
2020-03-01 10:54:11 -05:00
2021-06-29 15:02:44 -04:00
testImplementation ( testFixtures ( project ( ":libsignal-service" ) ) )
2021-09-14 14:57:04 -03:00
androidTestImplementation testLibs . androidx . test . ext . junit
androidTestImplementation testLibs . espresso . core
2022-05-16 10:15:56 -04:00
androidTestImplementation testLibs . androidx . test . core
androidTestImplementation testLibs . androidx . test . core . ktx
androidTestImplementation testLibs . androidx . test . ext . junit . ktx
2022-08-03 11:50:16 -04:00
androidTestImplementation testLibs . mockito . android
androidTestImplementation testLibs . mockito . kotlin
2023-03-03 11:42:30 -05:00
androidTestImplementation testLibs . mockk . android
2022-08-03 11:50:16 -04:00
androidTestImplementation testLibs . square . okhttp . mockserver
2021-04-13 17:12:54 -04:00
2022-09-13 11:16:01 -03:00
instrumentationImplementation ( libs . androidx . fragment . testing ) {
2022-09-13 10:15:07 -03:00
exclude group: 'androidx.test' , module: 'core'
}
2021-10-12 15:55:54 -03:00
testImplementation testLibs . espresso . core
2021-09-16 11:45:50 -04:00
implementation libs . kotlin . stdlib . jdk8
implementation libs . kotlin . reflect
2021-09-14 14:57:04 -03:00
implementation libs . jackson . module . kotlin
2021-07-08 11:41:26 -04:00
2021-09-14 14:57:04 -03:00
implementation libs . rxjava3 . rxandroid
implementation libs . rxjava3 . rxkotlin
2021-12-08 13:22:36 -05:00
implementation libs . rxdogtag
2021-10-15 10:18:38 -04:00
2022-09-14 09:18:10 -03:00
androidTestUtil testLibs . androidx . test . orchestrator
2023-02-02 14:01:38 -04:00
implementation project ( ':core-ui' )
2023-02-06 11:04:40 -04:00
ktlintRuleset libs . ktlint . twitter . compose
2020-03-01 10:54:11 -05:00
}
2016-02-17 11:27:35 -08:00
def getLastCommitTimestamp ( ) {
2021-05-07 13:43:31 -04:00
if ( ! ( new File ( '.git' ) . exists ( ) ) ) {
return System . currentTimeMillis ( ) . toString ( )
}
2016-02-17 11:27:35 -08:00
new ByteArrayOutputStream ( ) . withStream { os - >
2022-12-08 12:57:35 -04:00
exec {
2016-02-17 11:27:35 -08:00
executable = 'git'
args = [ 'log' , '-1' , '--pretty=format:%ct' ]
standardOutput = os
}
return os . toString ( ) + "000"
}
}
2020-08-18 11:57:35 -03:00
2021-02-05 15:18:11 -05:00
def getGitHash ( ) {
2021-05-07 13:43:31 -04:00
if ( ! ( new File ( '.git' ) . exists ( ) ) ) {
2022-12-08 19:34:09 -05:00
throw new IllegalStateException ( "Must be a git repository to guarantee reproducible builds! (git hash is part of APK)" )
2021-05-07 13:43:31 -04:00
}
2021-02-05 15:18:11 -05:00
def stdout = new ByteArrayOutputStream ( )
exec {
2022-12-08 19:34:09 -05:00
commandLine 'git' , 'rev-parse' , 'HEAD'
2021-02-05 15:18:11 -05:00
standardOutput = stdout
}
2022-12-08 19:34:09 -05:00
return stdout . toString ( ) . trim ( ) . substring ( 0 , 12 )
2021-02-05 15:18:11 -05:00
}
2021-07-09 18:49:32 -04:00
def getCurrentGitTag ( ) {
if ( ! ( new File ( '.git' ) . exists ( ) ) ) {
2022-12-08 19:34:09 -05:00
throw new IllegalStateException ( "Must be a git repository to guarantee reproducible builds! (git hash is part of APK)" )
2021-07-09 18:49:32 -04:00
}
def stdout = new ByteArrayOutputStream ( )
exec {
commandLine 'git' , 'tag' , '--points-at' , 'HEAD'
standardOutput = stdout
}
def output = stdout . toString ( ) . trim ( )
if ( output ! = null & & output . size ( ) > 0 ) {
2021-11-17 21:17:36 -05:00
def tags = output . split ( '\n' ) . toList ( )
return tags . stream ( ) . filter ( t - > t . contains ( 'nightly' ) ) . findFirst ( ) . orElse ( tags . get ( 0 ) )
2021-07-09 18:49:32 -04:00
} else {
return null
}
}
2020-08-18 11:57:35 -03:00
tasks . withType ( Test ) {
testLogging {
events "failed"
exceptionFormat "full"
showCauses true
showExceptions true
showStackTraces true
}
}
2020-11-02 08:18:50 -05:00
2023-10-27 14:27:17 -07:00
project . tasks . configureEach { task - >
if ( task . name . toLowerCase ( ) . contains ( "nightly" ) & & task . name ! = 'checkNightlyParams' ) {
task . dependsOn checkNightlyParams
}
}
tasks . register ( 'checkNightlyParams' ) {
doFirst {
if ( project . gradle . startParameter . taskNames . any { it . toLowerCase ( ) . contains ( "nightly" ) } ) {
2023-11-01 22:05:37 -04:00
if ( ! file ( "${project.rootDir}/nightly-url.txt" ) . exists ( ) ) {
throw new GradleException ( "Cannot fine 'nightly-url.txt' for nightly build! It must exist in the root of this project and contain the location of the nightly manifest." )
2023-10-27 14:27:17 -07:00
}
}
}
}
2020-11-02 08:18:50 -05:00
def loadKeystoreProperties ( filename ) {
def keystorePropertiesFile = file ( "${project.rootDir}/${filename}" )
if ( keystorePropertiesFile . exists ( ) ) {
def keystoreProperties = new Properties ( )
keystoreProperties . load ( new FileInputStream ( keystorePropertiesFile ) )
2022-12-08 12:57:35 -04:00
return keystoreProperties
2020-11-02 08:18:50 -05:00
} else {
2022-12-08 12:57:35 -04:00
return null
2020-11-02 08:18:50 -05:00
}
}
2021-07-08 09:25:35 -04:00
2022-12-08 12:57:35 -04:00
static def getDateSuffix ( ) {
2021-07-08 09:25:35 -04:00
def date = new Date ( )
def formattedDate = date . format ( 'yyyy-MM-dd-HH:mm' )
return formattedDate
}
2022-08-04 13:21:11 -04:00
def getMapsKey ( ) {
def mapKey = file ( "${project.rootDir}/maps.key" )
if ( mapKey . exists ( ) ) {
return mapKey . readLines ( ) [ 0 ]
}
return "AIzaSyCSx9xea86GwDKGznCAULE9Y5a8b-TfN9U"
}