Torsten Grote | 6c53106 | 2020-09-25 10:23:32 -0300 | [diff] [blame] | 1 | plugins { |
| 2 | id "com.android.application" |
| 3 | id "kotlin-android" |
Torsten Grote | 7f4b565 | 2021-10-07 13:44:55 -0300 | [diff] [blame] | 4 | id "org.jlleitschuh.gradle.ktlint" version "10.2.0" |
Torsten Grote | 6c53106 | 2020-09-25 10:23:32 -0300 | [diff] [blame] | 5 | } |
Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 6 | |
Torsten Grote | 7694eb3 | 2020-10-23 10:25:44 -0300 | [diff] [blame] | 7 | def gitDescribe = { -> |
| 8 | def stdout = new ByteArrayOutputStream() |
| 9 | exec { |
| 10 | commandLine 'git', 'describe', '--always', '--tags', '--dirty=-dirty' |
| 11 | standardOutput = stdout |
| 12 | } |
| 13 | return stdout.toString().trim() |
| 14 | } |
| 15 | |
Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 16 | android { |
Torsten Grote | 6c633b7 | 2021-01-19 09:14:52 -0300 | [diff] [blame] | 17 | compileSdkVersion rootProject.ext.compileSdkVersion |
| 18 | buildToolsVersion rootProject.ext.buildToolsVersion |
Torsten Grote | 2434fe3 | 2019-06-03 12:23:09 -0300 | [diff] [blame] | 19 | |
| 20 | defaultConfig { |
Torsten Grote | 45ac888 | 2020-09-09 18:12:02 -0300 | [diff] [blame] | 21 | minSdkVersion 29 // leave at 29 for robolectric tests |
Torsten Grote | 6c633b7 | 2021-01-19 09:14:52 -0300 | [diff] [blame] | 22 | targetSdkVersion rootProject.ext.targetSdkVersion |
Torsten Grote | 7694eb3 | 2020-10-23 10:25:44 -0300 | [diff] [blame] | 23 | versionNameSuffix "-$gitDescribe" |
Torsten Grote | e955e02 | 2019-08-06 08:16:37 +0200 | [diff] [blame] | 24 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
Torsten Grote | b9cac5e | 2019-12-18 13:14:25 -0300 | [diff] [blame] | 25 | testInstrumentationRunnerArguments disableAnalytics: 'true' |
Torsten Grote | 2434fe3 | 2019-06-03 12:23:09 -0300 | [diff] [blame] | 26 | } |
Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 27 | |
| 28 | buildTypes { |
| 29 | release { |
| 30 | minifyEnabled false |
Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 31 | } |
| 32 | } |
| 33 | |
| 34 | lintOptions { |
Torsten Grote | 7f4b565 | 2021-10-07 13:44:55 -0300 | [diff] [blame] | 35 | disable "DialogFragmentCallbacksDetector", |
| 36 | "InvalidFragmentVersionForActivityResult", |
| 37 | "CheckedExceptions" |
Torsten Grote | 57f4042 | 2020-09-14 17:47:01 -0300 | [diff] [blame] | 38 | abortOnError true |
Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 39 | } |
| 40 | compileOptions { |
Aayush Gupta | 4b84278 | 2022-08-19 21:12:42 +0530 | [diff] [blame^] | 41 | sourceCompatibility = JavaVersion.VERSION_11 |
| 42 | targetCompatibility = JavaVersion.VERSION_11 |
Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 43 | } |
Torsten Grote | fcf17fe | 2020-01-18 15:39:53 -0300 | [diff] [blame] | 44 | kotlinOptions { |
Aayush Gupta | 4b84278 | 2022-08-19 21:12:42 +0530 | [diff] [blame^] | 45 | jvmTarget = JavaVersion.VERSION_11.toString() |
Aayush Gupta | c48aa73 | 2022-08-19 11:10:30 +0530 | [diff] [blame] | 46 | languageVersion = "1.6" |
Torsten Grote | fcf17fe | 2020-01-18 15:39:53 -0300 | [diff] [blame] | 47 | } |
Torsten Grote | 2ce625a | 2019-07-09 19:22:24 +0200 | [diff] [blame] | 48 | testOptions { |
| 49 | unitTests.all { |
| 50 | useJUnitPlatform() |
| 51 | testLogging { |
| 52 | events "passed", "skipped", "failed" |
| 53 | } |
| 54 | } |
Torsten Grote | b9cac5e | 2019-12-18 13:14:25 -0300 | [diff] [blame] | 55 | unitTests { |
| 56 | includeAndroidResources = true |
| 57 | } |
Torsten Grote | 2ce625a | 2019-07-09 19:22:24 +0200 | [diff] [blame] | 58 | } |
Torsten Grote | d1f5986 | 2019-06-03 15:51:58 -0300 | [diff] [blame] | 59 | |
Torsten Grote | 74aa62a | 2019-08-20 13:04:09 +0200 | [diff] [blame] | 60 | sourceSets { |
| 61 | test { |
| 62 | java.srcDirs += "$projectDir/src/sharedTest/java" |
| 63 | } |
| 64 | androidTest { |
| 65 | java.srcDirs += "$projectDir/src/sharedTest/java" |
| 66 | } |
| 67 | } |
| 68 | |
Chirayu Desai | b08b1f5 | 2021-02-19 22:05:47 +0530 | [diff] [blame] | 69 | signingConfigs { |
| 70 | aosp { |
| 71 | // Generated from the AOSP platform key: |
| 72 | // https://android.googlesource.com/platform/build/+/refs/tags/android-11.0.0_r29/target/product/security/platform.pk8 |
| 73 | keyAlias "platform" |
| 74 | keyPassword "platform" |
| 75 | storeFile file("platform.jks") |
| 76 | storePassword "platform" |
Torsten Grote | d1f5986 | 2019-06-03 15:51:58 -0300 | [diff] [blame] | 77 | } |
Torsten Grote | d1f5986 | 2019-06-03 15:51:58 -0300 | [diff] [blame] | 78 | } |
Chirayu Desai | b08b1f5 | 2021-02-19 22:05:47 +0530 | [diff] [blame] | 79 | |
| 80 | buildTypes.release.signingConfig = signingConfigs.aosp |
| 81 | buildTypes.debug.signingConfig = signingConfigs.aosp |
Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 82 | } |
| 83 | |
Torsten Grote | 6c633b7 | 2021-01-19 09:14:52 -0300 | [diff] [blame] | 84 | dependencies { |
| 85 | compileOnly rootProject.ext.aosp_libs |
| 86 | |
| 87 | /** |
| 88 | * Dependencies in AOSP |
| 89 | * |
| 90 | * We try to keep the dependencies in sync with what AOSP ships as Seedvault is meant to be built |
| 91 | * with the AOSP build system and gradle builds are just for more pleasant development. |
| 92 | * Using the AOSP versions in gradle builds allows us to spot issues early on. |
| 93 | */ |
| 94 | implementation rootProject.ext.kotlin_libs.std |
| 95 | // These coroutine libraries get upgraded otherwise to versions incompatible with kotlin version |
| 96 | implementation rootProject.ext.kotlin_libs.coroutines |
| 97 | |
| 98 | implementation rootProject.ext.std_libs.androidx_core |
| 99 | // A newer version gets pulled in with AOSP via core, so we include fragment here explicitly |
| 100 | implementation rootProject.ext.std_libs.androidx_fragment |
Torsten Grote | 7f4b565 | 2021-10-07 13:44:55 -0300 | [diff] [blame] | 101 | implementation rootProject.ext.std_libs.androidx_activity |
Torsten Grote | 6c633b7 | 2021-01-19 09:14:52 -0300 | [diff] [blame] | 102 | implementation rootProject.ext.std_libs.androidx_preference |
| 103 | implementation rootProject.ext.std_libs.androidx_lifecycle_viewmodel_ktx |
| 104 | implementation rootProject.ext.std_libs.androidx_lifecycle_livedata_ktx |
| 105 | implementation rootProject.ext.std_libs.androidx_constraintlayout |
| 106 | implementation rootProject.ext.std_libs.androidx_documentfile |
| 107 | implementation rootProject.ext.std_libs.com_google_android_material |
| 108 | |
Torsten Grote | 3ffb79b | 2021-09-07 17:10:20 +0200 | [diff] [blame] | 109 | implementation rootProject.ext.storage_libs.com_google_crypto_tink_android |
| 110 | |
Torsten Grote | 6c633b7 | 2021-01-19 09:14:52 -0300 | [diff] [blame] | 111 | /** |
| 112 | * Storage Dependencies |
| 113 | */ |
| 114 | implementation project(':storage:lib') |
Torsten Grote | 6c633b7 | 2021-01-19 09:14:52 -0300 | [diff] [blame] | 115 | |
| 116 | /** |
| 117 | * External Dependencies |
| 118 | * |
| 119 | * If the dependencies below are updated, |
| 120 | * please make sure to update the prebuilt libraries and the Android.bp files |
| 121 | * in the top-level `libs` folder to reflect that. |
Torsten Grote | 7f4b565 | 2021-10-07 13:44:55 -0300 | [diff] [blame] | 122 | * You can copy these libraries from ~/.gradle/caches/modules-2/files-2.1 |
Torsten Grote | 6c633b7 | 2021-01-19 09:14:52 -0300 | [diff] [blame] | 123 | */ |
| 124 | // later versions than 2.1.1 require newer kotlin version |
Torsten Grote | 7f4b565 | 2021-10-07 13:44:55 -0300 | [diff] [blame] | 125 | // implementation "io.insert-koin:koin-core-jvm:3.1.2" |
| 126 | // implementation "io.insert-koin:koin-android:3.1.2" |
Torsten Grote | 6c633b7 | 2021-01-19 09:14:52 -0300 | [diff] [blame] | 127 | implementation fileTree(include: ['*.jar'], dir: "${rootProject.rootDir}/libs/koin-android") |
| 128 | implementation fileTree(include: ['*.aar'], dir: "${rootProject.rootDir}/libs/koin-android") |
| 129 | |
Torsten Grote | 7f4b565 | 2021-10-07 13:44:55 -0300 | [diff] [blame] | 130 | // implementation "cash.z.ecc.android:kotlin-bip39:1.0.2" |
Torsten Grote | 05640eb | 2021-07-02 16:46:55 -0300 | [diff] [blame] | 131 | implementation fileTree(include: ['kotlin-bip39-1.0.2.jar'], dir: "${rootProject.rootDir}/libs") |
Torsten Grote | 6c633b7 | 2021-01-19 09:14:52 -0300 | [diff] [blame] | 132 | |
| 133 | /** |
| 134 | * Test Dependencies (do not concern the AOSP build) |
| 135 | */ |
| 136 | lintChecks rootProject.ext.lint_libs.exceptions |
| 137 | |
| 138 | // anything less than 'implementation' fails tests run with gradlew |
| 139 | testImplementation rootProject.ext.aosp_libs |
Torsten Grote | 7f4b565 | 2021-10-07 13:44:55 -0300 | [diff] [blame] | 140 | testImplementation 'androidx.test.ext:junit:1.1.3' |
Torsten Grote | 6c633b7 | 2021-01-19 09:14:52 -0300 | [diff] [blame] | 141 | testImplementation('org.robolectric:robolectric:4.3.1') { // 4.4 has issue with non-idle Looper |
| 142 | // https://github.com/robolectric/robolectric/issues/5245 |
| 143 | exclude group: "com.google.auto.service", module: "auto-service" |
| 144 | } |
| 145 | testImplementation "org.junit.jupiter:junit-jupiter-api:$junit5_version" |
Torsten Grote | d6a95e4 | 2021-09-02 13:45:56 +0200 | [diff] [blame] | 146 | testImplementation "org.junit.jupiter:junit-jupiter-params:$junit5_version" |
Torsten Grote | 6c633b7 | 2021-01-19 09:14:52 -0300 | [diff] [blame] | 147 | testImplementation "io.mockk:mockk:$mockk_version" |
Torsten Grote | d6a95e4 | 2021-09-02 13:45:56 +0200 | [diff] [blame] | 148 | testImplementation 'org.bitcoinj:bitcoinj-core:0.15.10' |
Torsten Grote | 6c633b7 | 2021-01-19 09:14:52 -0300 | [diff] [blame] | 149 | testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit5_version" |
| 150 | testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$junit5_version" |
| 151 | |
Torsten Grote | 7f4b565 | 2021-10-07 13:44:55 -0300 | [diff] [blame] | 152 | androidTestImplementation 'androidx.test:runner:1.4.0' |
| 153 | androidTestImplementation 'androidx.test:rules:1.4.0' |
| 154 | androidTestImplementation 'androidx.test.ext:junit:1.1.3' |
Torsten Grote | 6c633b7 | 2021-01-19 09:14:52 -0300 | [diff] [blame] | 155 | androidTestImplementation "io.mockk:mockk-android:$mockk_version" |
| 156 | } |
Torsten Grote | d2ed3a1 | 2020-09-15 17:16:22 -0300 | [diff] [blame] | 157 | |
Torsten Grote | b8ac11e | 2021-03-03 16:06:26 -0300 | [diff] [blame] | 158 | apply from: "${rootProject.rootDir}/gradle/ktlint.gradle" |
Torsten Grote | 6c53106 | 2020-09-25 10:23:32 -0300 | [diff] [blame] | 159 | |
Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 160 | gradle.projectsEvaluated { |
| 161 | tasks.withType(JavaCompile) { |
| 162 | options.compilerArgs.add('-Xbootclasspath/p:app/libs/android.jar:app/libs/libcore.jar') |
| 163 | } |
| 164 | } |
| 165 | |
Torsten Grote | d2ed3a1 | 2020-09-15 17:16:22 -0300 | [diff] [blame] | 166 | configurations { |
| 167 | all { |
| 168 | resolutionStrategy { |
| 169 | failOnNonReproducibleResolution() |
| 170 | } |
Torsten Grote | ceac5fc | 2020-09-11 15:42:10 -0300 | [diff] [blame] | 171 | } |
Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 172 | } |