2019-11-26 12:29:16 -08:00
import cash.z.ecc.android.Deps
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
2021-04-23 11:28:38 -07:00
apply plugin: "androidx.navigation.safeargs.kotlin"
2019-11-26 12:29:16 -08:00
//apply plugin: 'com.github.ben-manes.versions'
archivesBaseName = 'zcash-android-wallet'
group = 'cash.z.ecc.android'
2020-10-07 17:19:19 -07:00
version = Deps . versionName
2019-11-26 12:29:16 -08:00
android {
2020-06-10 04:49:38 -07:00
ndkVersion "21.1.6352462"
2019-11-26 12:29:16 -08:00
compileSdkVersion Deps . compileSdkVersion
buildToolsVersion Deps . buildToolsVersion
viewBinding . enabled = true
defaultConfig {
2020-10-07 17:19:19 -07:00
applicationId Deps . packageName
2019-11-26 12:29:16 -08:00
minSdkVersion Deps . minSdkVersion
targetSdkVersion Deps . targetSdkVersion
2020-10-07 17:19:19 -07:00
versionCode = Deps . versionCode
versionName = Deps . versionName
2019-11-26 12:29:16 -08:00
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
2019-12-23 11:21:38 -08:00
testInstrumentationRunnerArguments clearPackageData: 'true'
multiDexEnabled true
2020-08-13 20:24:43 -07:00
resValue 'string' , 'bugsnag_api_key' , "${(project.findProperty('BUGSNAG_API_KEY') ?: System.getenv('BUGSNAG_API_KEY')) ?: ''}"
2020-08-27 17:20:27 -07:00
// this setting allows using color resources in vector drawables, rather than hardcoded values (note: only works when minApi is 21)
// per https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.VectorDrawablesOptions.html: If set to an empty collection, all special handling of vector drawables will be disabled.
vectorDrawables . generatedDensities = [ ]
2019-11-26 12:29:16 -08:00
}
flavorDimensions 'network'
productFlavors {
// would rather name them "testnet" and "mainnet" but product flavor names cannot start with the word "test"
zcashtestnet {
dimension 'network'
applicationId 'cash.z.ecc.android.testnet'
2021-01-31 15:26:58 -08:00
buildConfigField "String" , "DEFAULT_SERVER_URL" , '"lightwalletd.testnet.electriccoin.co"'
2019-11-26 12:29:16 -08:00
matchingFallbacks = [ 'zcashtestnet' , 'debug' ]
}
zcashmainnet {
dimension 'network'
2021-01-31 15:26:58 -08:00
buildConfigField "String" , "DEFAULT_SERVER_URL" , '"lightwalletd.electriccoin.co"'
2019-11-26 12:29:16 -08:00
matchingFallbacks = [ 'zcashmainnet' , 'release' ]
}
}
2020-06-10 14:09:20 -07:00
signingConfigs {
placeholder {
storeFile file ( "${rootProject.projectDir}/placeholder.keystore" )
keyAlias "androiddebugkey"
keyPassword "android"
storePassword "android"
2020-01-31 08:32:36 -08:00
}
}
2019-11-26 12:29:16 -08:00
buildTypes {
release {
2020-06-10 14:09:20 -07:00
minifyEnabled false
shrinkResources false
2019-11-26 12:29:16 -08:00
proguardFiles getDefaultProguardFile ( 'proguard-android-optimize.txt' ) , 'proguard-rules.pro'
2020-06-10 14:09:20 -07:00
signingConfig signingConfigs . placeholder
2019-11-26 12:29:16 -08:00
}
debug {
2019-12-23 11:21:38 -08:00
minifyEnabled false
shrinkResources false
2019-11-26 12:29:16 -08:00
proguardFiles getDefaultProguardFile ( 'proguard-android-optimize.txt' ) , 'proguard-rules.pro'
}
2020-10-07 17:19:19 -07:00
// builds for testing only in the wallet team, typically unfinished features
// this flavor can be installed alongside the others
qa {
initWith debug
2020-10-09 09:03:02 -07:00
debuggable true
2020-10-07 17:19:19 -07:00
applicationIdSuffix ".internal"
matchingFallbacks = [ 'debug' ]
2021-04-21 15:04:50 -07:00
signingConfig signingConfigs . placeholder
2020-10-07 17:19:19 -07:00
}
2019-11-26 12:29:16 -08:00
}
compileOptions {
2021-05-26 07:04:47 -07:00
// emable support for new langauge APIs but also fix the issue with zxing on API < 24
coreLibraryDesugaringEnabled true
2019-11-26 12:29:16 -08:00
sourceCompatibility JavaVersion . VERSION_1_8
targetCompatibility JavaVersion . VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
2020-10-07 17:19:19 -07:00
freeCompilerArgs + = "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi"
2021-04-23 11:28:38 -07:00
freeCompilerArgs + = "-Xopt-in=kotlin.time.ExperimentalTime"
2020-10-07 17:19:19 -07:00
// freeCompilerArgs += "-Xopt-in=kotlinx.coroutines.ObsoleteCoroutinesApi"
// freeCompilerArgs += "-Xopt-in=kotlinx.coroutines.FlowPreview"
2019-11-26 12:29:16 -08:00
}
2021-04-23 11:28:38 -07:00
testOptions {
execution 'ANDROIDX_TEST_ORCHESTRATOR'
}
2020-01-05 21:01:06 -08:00
kapt {
arguments {
arg 'dagger.fastInit' , 'enabled'
arg 'dagger.fullBindingGraphValidation' , 'ERROR'
arg 'dagger.gradle.incremental'
}
}
2020-09-25 08:50:20 -07:00
packagingOptions {
exclude 'META-INF/AL2.0'
exclude 'META-INF/LGPL2.1'
}
2019-12-18 10:24:06 -08:00
applicationVariants . all { variant - >
variant . outputs . all {
2020-10-07 17:19:19 -07:00
if ( variant . buildType . name = = "qa" ) {
it . versionNameOverride = "${Deps.versionName}-QA"
}
outputFileName = "$archivesBaseName-v${Deps.versionName}-${variant.buildType.name}.apk"
2019-12-18 10:24:06 -08:00
}
}
2019-11-26 12:29:16 -08:00
}
dependencies {
implementation fileTree ( dir: 'libs' , include: [ '*.jar' ] )
implementation project ( ':qrecycler' )
2019-12-14 11:39:19 -08:00
implementation project ( ':feedback' )
2019-12-15 15:08:04 -08:00
implementation project ( ':mnemonic' )
implementation project ( ':lockbox' )
2019-11-26 12:29:16 -08:00
2020-02-12 05:03:14 -08:00
// Zcash
2020-06-10 04:49:38 -07:00
implementation Deps . Zcash . ANDROID_WALLET_PLUGINS
2021-04-21 15:04:50 -07:00
implementation Deps . Zcash . SDK
2020-06-10 04:49:38 -07:00
2019-11-26 12:29:16 -08:00
// Kotlin
implementation Deps . Kotlin . STDLIB
// Android
2020-06-10 04:49:38 -07:00
implementation Deps . AndroidX . ANNOTATION
2019-11-26 12:29:16 -08:00
implementation Deps . AndroidX . APPCOMPAT
2020-07-31 23:46:49 -07:00
implementation Deps . AndroidX . BIOMETRICS
2019-11-26 12:29:16 -08:00
implementation Deps . AndroidX . CONSTRAINT_LAYOUT
2020-06-10 04:49:38 -07:00
implementation Deps . AndroidX . CORE_KTX
implementation Deps . AndroidX . FRAGMENT_KTX
implementation Deps . AndroidX . LEGACY
implementation Deps . AndroidX . PAGING
2020-08-28 00:19:13 -07:00
implementation Deps . AndroidX . RECYCLER
2020-06-10 04:49:38 -07:00
implementation Deps . AndroidX . CameraX . CAMERA2
implementation Deps . AndroidX . CameraX . CORE
implementation Deps . AndroidX . CameraX . LIFECYCLE
implementation Deps . AndroidX . CameraX . View . EXT
implementation Deps . AndroidX . CameraX . View . VIEW
implementation Deps . AndroidX . Lifecycle . LIFECYCLE_RUNTIME_KTX
2019-11-26 12:29:16 -08:00
implementation Deps . AndroidX . Navigation . FRAGMENT_KTX
implementation Deps . AndroidX . Navigation . UI_KTX
2020-06-10 04:49:38 -07:00
implementation Deps . AndroidX . Room . ROOM_KTX
kapt Deps . AndroidX . Room . ROOM_COMPILER
2021-05-26 07:04:47 -07:00
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
2019-11-26 12:29:16 -08:00
// Google
2020-06-10 04:49:38 -07:00
implementation Deps . Google . GUAVA
2019-11-26 12:29:16 -08:00
implementation Deps . Google . MATERIAL
// Dagger
implementation Deps . Dagger . ANDROID_SUPPORT
kapt Deps . Dagger . ANDROID_PROCESSOR
kapt Deps . Dagger . COMPILER
2019-12-14 11:39:19 -08:00
// grpc-java
2020-06-10 04:49:38 -07:00
implementation Deps . Grpc . ANDROID
implementation Deps . Grpc . OKHTTP
implementation Deps . Grpc . PROTOBUG
implementation Deps . Grpc . STUB
implementation Deps . JavaX . JAVA_ANNOTATION
// Analytics (for dogfooding/crash-reporting/feedback only on internal team builds)
implementation Deps . Analytics . MIXPANEL
2020-08-13 20:24:43 -07:00
implementation Deps . Analytics . BUGSNAG
2020-01-08 00:42:49 -08:00
2020-01-13 16:09:22 -08:00
// Misc.
2020-06-10 04:49:38 -07:00
implementation Deps . Misc . LOTTIE
2020-06-10 14:09:20 -07:00
implementation Deps . Misc . CHIPS
2021-02-28 09:38:00 -08:00
implementation Deps . Misc . Plugins . QR_SCANNER
2020-01-13 16:09:22 -08:00
2019-11-26 12:29:16 -08:00
// Tests
testImplementation Deps . Test . JUNIT
2020-06-10 04:49:38 -07:00
testImplementation Deps . Test . MOKITO
2020-10-07 17:19:19 -07:00
testImplementation Deps . Test . MOKITO_KOTLIN
2019-11-26 12:29:16 -08:00
androidTestImplementation Deps . Test . Android . JUNIT
androidTestImplementation Deps . Test . Android . ESPRESSO
2021-02-14 14:01:19 -08:00
2019-11-26 12:29:16 -08:00
}
2020-06-10 08:25:20 -07:00
2021-05-03 08:22:16 -07:00
defaultTasks 'clean' , 'assembleZcashmainnetRelease'
apply from: "$rootDir/ktlint.gradle"
preBuild . dependsOn ( 'ktlintFormat' )
preBuild . dependsOn ( 'ktlint' )