blob: 09291b040c34915b4648133d4223eccfd164b196 [file] [log] [blame]
Torsten Grote6c531062020-09-25 10:23:32 -03001plugins {
2 id "com.android.application"
3 id "kotlin-android"
Torsten Grote7f4b5652021-10-07 13:44:55 -03004 id "org.jlleitschuh.gradle.ktlint" version "10.2.0"
Torsten Grote6c531062020-09-25 10:23:32 -03005}
Steve Soltyse8720182018-11-07 22:04:37 -05006
Torsten Grote7694eb32020-10-23 10:25:44 -03007def 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 Soltyse8720182018-11-07 22:04:37 -050016android {
Torsten Grote6c633b72021-01-19 09:14:52 -030017 compileSdkVersion rootProject.ext.compileSdkVersion
18 buildToolsVersion rootProject.ext.buildToolsVersion
Torsten Grote2434fe32019-06-03 12:23:09 -030019
20 defaultConfig {
Torsten Grote45ac8882020-09-09 18:12:02 -030021 minSdkVersion 29 // leave at 29 for robolectric tests
Torsten Grote6c633b72021-01-19 09:14:52 -030022 targetSdkVersion rootProject.ext.targetSdkVersion
Torsten Grote7694eb32020-10-23 10:25:44 -030023 versionNameSuffix "-$gitDescribe"
Torsten Grotee955e022019-08-06 08:16:37 +020024 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Torsten Groteb9cac5e2019-12-18 13:14:25 -030025 testInstrumentationRunnerArguments disableAnalytics: 'true'
Torsten Grote2434fe32019-06-03 12:23:09 -030026 }
Steve Soltyse8720182018-11-07 22:04:37 -050027
28 buildTypes {
29 release {
30 minifyEnabled false
Steve Soltyse8720182018-11-07 22:04:37 -050031 }
32 }
33
34 lintOptions {
Torsten Grote7f4b5652021-10-07 13:44:55 -030035 disable "DialogFragmentCallbacksDetector",
36 "InvalidFragmentVersionForActivityResult",
37 "CheckedExceptions"
Torsten Grote57f40422020-09-14 17:47:01 -030038 abortOnError true
Steve Soltyse8720182018-11-07 22:04:37 -050039 }
40 compileOptions {
Aayush Gupta4b842782022-08-19 21:12:42 +053041 sourceCompatibility = JavaVersion.VERSION_11
42 targetCompatibility = JavaVersion.VERSION_11
Steve Soltyse8720182018-11-07 22:04:37 -050043 }
Torsten Grotefcf17fe2020-01-18 15:39:53 -030044 kotlinOptions {
Aayush Gupta4b842782022-08-19 21:12:42 +053045 jvmTarget = JavaVersion.VERSION_11.toString()
Aayush Guptac48aa732022-08-19 11:10:30 +053046 languageVersion = "1.6"
Torsten Grotefcf17fe2020-01-18 15:39:53 -030047 }
Torsten Grote2ce625a2019-07-09 19:22:24 +020048 testOptions {
49 unitTests.all {
50 useJUnitPlatform()
51 testLogging {
52 events "passed", "skipped", "failed"
53 }
54 }
Torsten Groteb9cac5e2019-12-18 13:14:25 -030055 unitTests {
56 includeAndroidResources = true
57 }
Torsten Grote2ce625a2019-07-09 19:22:24 +020058 }
Torsten Groted1f59862019-06-03 15:51:58 -030059
Torsten Grote74aa62a2019-08-20 13:04:09 +020060 sourceSets {
61 test {
62 java.srcDirs += "$projectDir/src/sharedTest/java"
63 }
64 androidTest {
65 java.srcDirs += "$projectDir/src/sharedTest/java"
66 }
67 }
68
Chirayu Desaib08b1f52021-02-19 22:05:47 +053069 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 Groted1f59862019-06-03 15:51:58 -030077 }
Torsten Groted1f59862019-06-03 15:51:58 -030078 }
Chirayu Desaib08b1f52021-02-19 22:05:47 +053079
80 buildTypes.release.signingConfig = signingConfigs.aosp
81 buildTypes.debug.signingConfig = signingConfigs.aosp
Steve Soltyse8720182018-11-07 22:04:37 -050082}
83
Torsten Grote6c633b72021-01-19 09:14:52 -030084dependencies {
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 Grote7f4b5652021-10-07 13:44:55 -0300101 implementation rootProject.ext.std_libs.androidx_activity
Torsten Grote6c633b72021-01-19 09:14:52 -0300102 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 Grote3ffb79b2021-09-07 17:10:20 +0200109 implementation rootProject.ext.storage_libs.com_google_crypto_tink_android
110
Torsten Grote6c633b72021-01-19 09:14:52 -0300111 /**
112 * Storage Dependencies
113 */
114 implementation project(':storage:lib')
Torsten Grote6c633b72021-01-19 09:14:52 -0300115
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 Grote7f4b5652021-10-07 13:44:55 -0300122 * You can copy these libraries from ~/.gradle/caches/modules-2/files-2.1
Torsten Grote6c633b72021-01-19 09:14:52 -0300123 */
124 // later versions than 2.1.1 require newer kotlin version
Torsten Grote7f4b5652021-10-07 13:44:55 -0300125// implementation "io.insert-koin:koin-core-jvm:3.1.2"
126// implementation "io.insert-koin:koin-android:3.1.2"
Torsten Grote6c633b72021-01-19 09:14:52 -0300127 implementation fileTree(include: ['*.jar'], dir: "${rootProject.rootDir}/libs/koin-android")
128 implementation fileTree(include: ['*.aar'], dir: "${rootProject.rootDir}/libs/koin-android")
129
Torsten Grote7f4b5652021-10-07 13:44:55 -0300130// implementation "cash.z.ecc.android:kotlin-bip39:1.0.2"
Torsten Grote05640eb2021-07-02 16:46:55 -0300131 implementation fileTree(include: ['kotlin-bip39-1.0.2.jar'], dir: "${rootProject.rootDir}/libs")
Torsten Grote6c633b72021-01-19 09:14:52 -0300132
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 Grote7f4b5652021-10-07 13:44:55 -0300140 testImplementation 'androidx.test.ext:junit:1.1.3'
Torsten Grote6c633b72021-01-19 09:14:52 -0300141 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 Groted6a95e42021-09-02 13:45:56 +0200146 testImplementation "org.junit.jupiter:junit-jupiter-params:$junit5_version"
Torsten Grote6c633b72021-01-19 09:14:52 -0300147 testImplementation "io.mockk:mockk:$mockk_version"
Torsten Groted6a95e42021-09-02 13:45:56 +0200148 testImplementation 'org.bitcoinj:bitcoinj-core:0.15.10'
Torsten Grote6c633b72021-01-19 09:14:52 -0300149 testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit5_version"
150 testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$junit5_version"
151
Torsten Grote7f4b5652021-10-07 13:44:55 -0300152 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 Grote6c633b72021-01-19 09:14:52 -0300155 androidTestImplementation "io.mockk:mockk-android:$mockk_version"
156}
Torsten Groted2ed3a12020-09-15 17:16:22 -0300157
Torsten Groteb8ac11e2021-03-03 16:06:26 -0300158apply from: "${rootProject.rootDir}/gradle/ktlint.gradle"
Torsten Grote6c531062020-09-25 10:23:32 -0300159
Steve Soltyse8720182018-11-07 22:04:37 -0500160gradle.projectsEvaluated {
161 tasks.withType(JavaCompile) {
162 options.compilerArgs.add('-Xbootclasspath/p:app/libs/android.jar:app/libs/libcore.jar')
163 }
164}
165
Torsten Groted2ed3a12020-09-15 17:16:22 -0300166configurations {
167 all {
168 resolutionStrategy {
169 failOnNonReproducibleResolution()
170 }
Torsten Groteceac5fc2020-09-11 15:42:10 -0300171 }
Steve Soltyse8720182018-11-07 22:04:37 -0500172}