-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
325 lines (291 loc) · 11.8 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
buildscript {
ext {
deps = [
advrecyclerview : '1.0.0',
androidInstantApps : '1.1.0',
appsFlyer : '5.4.3',
autoValue : '1.7.4',
circleindicator : '2.1.6',
dagger : '2.31.2',
eventbus : '3.2.0',
facebook : '7.1.0',
facebookFlipper : '0.72.0',
findbugs : '3.0.2',
googleTagManager : '17.0.0',
gradleAndroidPlugin: '4.1.2',
gtoSupport : '3.7.2-SNAPSHOT',
guava : '30.1-android',
hamcrest : '2.2',
hilt : '2.31.2-alpha',
jacoco : '0.8.6',
jsoup : '1.13.1',
junit : '4.13.1',
kotlin : '1.4.21',
kotlinCoroutines : '1.4.2',
leakcanary : '2.5',
lightweightStream : '1.2.1',
lottie : '3.6.0',
materialDesign : '1.2.1',
mockito : '3.7.7',
mockitoKotlin : '2.1.0',
moshi : '1.11.0',
okhttp3 : '3.12.12',
okta : '1.0.16',
picasso : '2.8',
picassoTransforms : '2.3.1',
retrofit2 : '2.6.4',
robolectric : '4.5',
scarlet : '0.1.11',
snowplow : '1.7.1',
splitties : '3.0.0-beta01',
taptargetview : '1.13.0',
timber : '4.7.1',
tinderStateMachine : '0.2.0',
weakdelegate : '1.0.1',
youtubeplayer : '10.0.5'
]
deps.androidX = [
activity : '1.1.0',
annotation : '1.1.0',
appCompat : '1.2.0',
archCore : '2.1.0',
browser : '1.3.0',
cardView : '1.0.0',
collection : '1.1.0',
concurrent : '1.1.0',
constraintLayout : '2.0.4',
core : '1.3.2',
databinding : deps.gradleAndroidPlugin,
fragment : '1.2.5',
lifecycle : '2.2.0',
loader : '1.1.0',
multidex : '2.0.1',
recyclerView : '1.1.0',
room : '2.2.6',
swipeRefreshLayout: '1.1.0',
test : '1.2.0',
testJUnit : '1.1.2',
viewPager2 : '1.0.0',
work : '2.5.0',
]
deps.firebase = [
core : '18.0.2',
crashlytics : '17.3.1',
inAppMessaging: '19.1.3',
messaging : '21.0.1',
perf : '19.1.0',
]
bundledContent = [
tools : ['kgp', 'fourlaws', 'satisfied', 'teachmetoshare'],
attachments : ['attr-banner', 'attr-banner-about'],
languages : ['en'],
downloadTranslations: false,
]
uris = [
mobileContentApi: [
stage : "https://mobile-content-api-stage.cru.org/",
production: "https://mobile-content-api.cru.org/"
]
]
}
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:${deps.gradleAndroidPlugin}"
classpath "com.google.dagger:hilt-android-gradle-plugin:${deps.hilt}"
classpath 'com.google.firebase:perf-plugin:1.3.4'
classpath 'com.google.firebase:firebase-appdistribution-gradle:2.0.1'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
classpath 'com.google.gms:google-services:4.3.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${deps.kotlin}"
}
}
plugins {
id "com.getkeepsafe.dexcount" version "2.0.0" apply false
id "com.vanniktech.android.junit.jacoco" version "0.16.0"
id "de.undercouch.download" version "4.1.1" apply false
id "org.ajoberstar.grgit" version "4.1.0"
id "org.jlleitschuh.gradle.ktlint" version "9.4.1"
}
version '5.4.3-SNAPSHOT'
ext.versionCode = grgit.log(includes:['HEAD']).size() + 4029765
// define dependency versions for this project
ext {
applicationId = 'org.keynote.godtools.android'
compileSdk = 30
minSdk = 19
minSdkFeature = 21
targetSdk = 30
}
// configure dependency resolution
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url 'https://cruglobal.jfrog.io/cruglobal/list/maven-locals/' }
}
configurations.all { configuration ->
configuration.resolutionStrategy {
force "androidx.annotation:annotation:${deps.androidX.annotation}"
force "androidx.appcompat:appcompat:${deps.androidX.appCompat}"
force "androidx.fragment:fragment:${deps.androidX.fragment}"
force "androidx.loader:loader:${deps.androidX.loader}"
force "androidx.multidex:multidex:${deps.androidX.multidex}"
force "com.google.code.findbugs:jsr305:${deps.findbugs}"
force "junit:junit:${deps.junit}"
// force the correct version of transitive coroutine libraries
force "org.jetbrains.kotlinx:kotlinx-coroutines-reactive:${deps.kotlinCoroutines}"
// XXX: Force okhttp3 to older version to support older versions of Android.
// XXX: This can go away once we bump minimum android version to API-21+
force "com.squareup.okhttp3:okhttp:${deps.okhttp3}"
dependencySubstitution {
substitute module('org.jetbrains.kotlin:kotlin-stdlib-jdk8') with module("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${deps.kotlin}")
// use the new condensed version of hamcrest
substitute module('org.hamcrest:hamcrest-core') with module("org.hamcrest:hamcrest:${deps.hamcrest}")
substitute module('org.hamcrest:hamcrest-library') with module("org.hamcrest:hamcrest:${deps.hamcrest}")
// use regular moshi library instead of moshi-kotlin, any Kotlin moshi models should use moshi-kotlin-codegen instead
substitute module('com.squareup.moshi:moshi-kotlin') with module("com.squareup.moshi:moshi:${deps.moshi}")
}
}
}
}
// base app plugins
configure(subprojects.findAll { it.path == ":app" }) {
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
}
// base library plugins
configure(subprojects.findAll { it.path.startsWith(":library:") || it.path.startsWith(":ui:") }) {
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
defaultConfig {
manifestPlaceholders = [appAuthRedirectScheme: "org.cru.godtools.library.test"]
}
}
}
// base feature plugins
configure(subprojects.findAll { it.path.startsWith(":feature:") }) {
apply plugin: "com.android.dynamic-feature"
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
flavorDimensions "env"
productFlavors {
stage {
dimension "env"
}
production {
dimension "env"
}
}
}
dependencies {
implementation project(":app")
}
}
// common config
subprojects {
beforeEvaluate { project ->
if (project.hasProperty('android')) {
android {
compileSdkVersion rootProject.compileSdk
defaultConfig {
versionCode rootProject.versionCode
minSdkVersion rootProject.minSdk
targetSdkVersion rootProject.targetSdk
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
freeCompilerArgs += '-Xjvm-default=all'
}
lintOptions {
lintConfig rootProject.file("analysis/lint/lint.xml")
}
testOptions {
unitTests {
includeAndroidResources = true
all {
// increase unit tests max heap size
jvmArgs "-Xmx2g"
// enable only SDKs we actually support in robolectric
// TODO: SDK >= 29 requires Java 9 which we don't currently support
systemProperty 'robolectric.enabledSdks', (rootProject.minSdk..28).join(" ")
}
}
}
// only include stage variants for the debug buildType
variantFilter { variant ->
if (variant.flavors*.name.contains("stage") && variant.buildType.name != "debug") setIgnore(true)
}
}
dependencies {
compileOnly "androidx.annotation:annotation:${deps.androidX.annotation}"
compileOnly "com.google.code.findbugs:jsr305:${deps.findbugs}"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${deps.kotlin}"
implementation "com.jakewharton.timber:timber:${deps.timber}"
testImplementation "androidx.test.ext:junit:${deps.androidX.testJUnit}"
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:${deps.mockitoKotlin}"
testImplementation "junit:junit:${deps.junit}"
testImplementation "org.mockito:mockito-inline:${deps.mockito}"
testImplementation "org.robolectric:robolectric:${deps.robolectric}"
}
}
}
}
// configure checkstyle
subprojects {
apply plugin: 'checkstyle'
checkstyle {
toolVersion '8.0'
}
task checkstyle(type: Checkstyle) {
configFile rootProject.file('analysis/checkstyle/checkstyle.xml')
source 'src'
include '*/java/**/*.java'
ignoreFailures false
showViolations true
classpath = files()
}
afterEvaluate {
['checkProductionRelease', 'checkProductionDebug', 'checkStageDebug', 'checkRelease', 'checkDebug', 'check'].each {
project.tasks.findByName(it)?.dependsOn('checkstyle')
}
}
}
// configure ktlint
subprojects {
apply plugin: "org.jlleitschuh.gradle.ktlint"
ktlint {
version = '0.40.0'
android = true
reporters {
reporter(ReporterType.PLAIN_GROUP_BY_FILE)
reporter(ReporterType.CHECKSTYLE)
}
}
}
// jacoco config
junitJacoco {
jacocoVersion = deps.jacoco
includeNoLocationClasses = true
}
task jacocoTestReport {
subprojects.each { dependsOn(it.tasks.withType(JacocoReport)) }
}
allprojects {
if (gradle.startParameter.excludedTaskNames.contains("test")) {
// exclude all test type tasks when the test task is excluded
tasks.withType(Test).all { gradle.startParameter.excludedTaskNames += it.name }
}
}