-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
build.gradle
667 lines (587 loc) · 28.5 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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
import io.sentry.android.gradle.extensions.InstrumentationFeature
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.kotlin.allopen)
alias(libs.plugins.sentry)
alias(libs.plugins.google.services)
alias(libs.plugins.google.dagger.hilt)
alias(libs.plugins.kotlinx.kover)
alias(libs.plugins.ksp)
alias(libs.plugins.fladle)
}
fladle {
testTargets = [
"notPackage org.wordpress.android.ui.screenshots"
]
configs {
wordpress {
def app = "wordpress"
debugApk.set(appPathForVariant(app))
instrumentationApk.set(testPathForVariant(app))
smartFlankGcsPath.set(pathForSmartFlankGcsPath(app))
/* Ignoring (already ignored by JUnit#assume) specific tests on the WordPress app to
prevent Fladle/Flank from scenario of executing them on a single shard.
This avoidance helps prevent test failures due to overly aggressive sharding that
could incur unnecessary costs and tests run failure. */
testTargets.set(testTargets.get() + [
"notClass org.wordpress.android.e2e.StatsTests",
"notClass org.wordpress.android.e2e.StatsGranularTabsTest",
])
}
jetpack {
def app = "jetpack"
debugApk.set(appPathForVariant(app))
instrumentationApk.set(testPathForVariant(app))
smartFlankGcsPath.set(pathForSmartFlankGcsPath(app))
}
}
serviceAccountCredentials = new File(System.getProperty("user.home"), ".configure/wordpress-android/secrets/firebase.secrets.json")
devices = [
["model": "Pixel2.arm", "version": "30"]
]
localResultsDir = "$rootDir/build/instrumented-tests"
maxTestShards = 50
shardTime = 120
}
String appPathForVariant(String app) {
String path = "outputs/apk/${app}Vanilla/debug"
return new File(layout.buildDirectory.dir(path).get().asFile, '*.apk').absolutePath
}
String testPathForVariant(String app) {
String path = "outputs/apk/androidTest/${app}Vanilla/debug"
return new File(layout.buildDirectory.dir(path).get().asFile, '*.apk').absolutePath
}
static String pathForSmartFlankGcsPath(String app) {
return "gs://fladle/wordpress-android/${app}/smart-flank/JUnitReport.xml"
}
sentry {
tracingInstrumentation {
enabled = true
features = [InstrumentationFeature.DATABASE]
logcat.enabled = false
}
autoInstallation.enabled = false
includeDependenciesReport = false
includeSourceContext = gradle.ext.isCi
includeProguardMapping = gradle.ext.isCi
/* Sentry won't send source context or add performance instrumentations for debug builds
so we can save build times. Sending events will still work in debug builds
(if enabled in WPCrashLoggingDataProvider).
*/
ignoredBuildTypes = ["debug"]
telemetry = false
}
allOpen {
// allows mocking for classes w/o directly opening them for release builds
annotation 'org.wordpress.android.testing.OpenClassAnnotation'
}
android {
useLibrary 'android.test.runner'
useLibrary 'android.test.base'
useLibrary 'android.test.mock'
namespace "org.wordpress.android"
def versionProperties = loadPropertiesFromFile(file("${rootDir}/version.properties"))
defaultConfig {
applicationId "org.wordpress.android"
archivesBaseName = "$applicationId"
versionName project.findProperty("prototypeBuildVersionName") ?: versionProperties.getProperty("versionName")
versionCode versionProperties.getProperty("versionCode").toInteger()
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
compileSdk rootProject.compileSdkVersion
testInstrumentationRunner 'org.wordpress.android.WordPressTestRunner'
buildConfigField "boolean", "OFFER_GUTENBERG", "true"
buildConfigField "boolean", "ENABLE_DEBUG_SETTINGS", "true"
buildConfigField "boolean", "SEEN_UNSEEN_WITH_COUNTER", "false"
buildConfigField "boolean", "LIKES_ENHANCEMENTS", "false"
buildConfigField "boolean", "IS_JETPACK_APP", "false"
buildConfigField "String", "TRACKS_EVENT_PREFIX", '"wpandroid_"'
buildConfigField "String", "PUSH_NOTIFICATIONS_APP_KEY", '"org.wordpress.android"'
buildConfigField "boolean", "MP4_COMPOSER_VIDEO_OPTIMIZATION", "false"
buildConfigField "boolean", "MANAGE_CATEGORIES", "false"
buildConfigField "boolean", "RECOMMEND_THE_APP", "false"
buildConfigField "boolean", "UNIFIED_COMMENTS_DETAILS", "false"
buildConfigField "boolean", "COMMENTS_SNIPPET", "false"
buildConfigField "boolean", "READER_COMMENTS_MODERATION", "false"
buildConfigField "boolean", "SITE_NAME", "false"
buildConfigField "boolean", "LAND_ON_THE_EDITOR", "false"
buildConfigField "boolean", "QRCODE_AUTH_FLOW", "false"
buildConfigField "boolean", "BETA_SITE_DESIGNS", "false"
buildConfigField "boolean", "JETPACK_POWERED", "true"
buildConfigField "boolean", "JETPACK_POWERED_BOTTOM_SHEET", "true"
buildConfigField "boolean", "JETPACK_SHARED_LOGIN", "true"
buildConfigField "boolean", "JETPACK_LOCAL_USER_FLAGS", "true"
buildConfigField "boolean", "JETPACK_BLOGGING_REMINDERS_SYNC", "true"
buildConfigField "boolean", "JETPACK_READER_SAVED_POSTS", "true"
buildConfigField "boolean", "JETPACK_PROVIDER_SYNC", "true"
buildConfigField "boolean", "JETPACK_MIGRATION_FLOW", "true"
buildConfigField "boolean", "JETPACK_FEATURE_REMOVAL_PHASE_ONE", "false"
buildConfigField "boolean", "JETPACK_FEATURE_REMOVAL_PHASE_TWO", "false"
buildConfigField "boolean", "JETPACK_FEATURE_REMOVAL_PHASE_THREE", "false"
buildConfigField "boolean", "JETPACK_FEATURE_REMOVAL_PHASE_FOUR", "false"
buildConfigField "boolean", "JETPACK_FEATURE_REMOVAL_NEW_USERS", "false"
buildConfigField "boolean", "JETPACK_FEATURE_REMOVAL_STATIC_POSTERS", "false"
buildConfigField "boolean", "JETPACK_FEATURE_REMOVAL_SELF_HOSTED_USERS", "false"
buildConfigField "boolean", "PREVENT_DUPLICATE_NOTIFS_REMOTE_FIELD", "false"
buildConfigField "boolean", "OPEN_WEB_LINKS_WITH_JETPACK_FLOW", "false"
buildConfigField "boolean", "ENABLE_BLAZE_FEATURE", "false"
buildConfigField "boolean", "WP_INDIVIDUAL_PLUGIN_OVERLAY", "false"
buildConfigField "boolean", "SITE_EDITOR_MVP", "false"
buildConfigField "boolean", "CONTACT_SUPPORT_CHATBOT", "false"
buildConfigField "boolean", "ENABLE_DOMAIN_MANAGEMENT_FEATURE", "false"
buildConfigField "boolean", "PLANS_IN_SITE_CREATION", "false"
buildConfigField "boolean", "BLOGANUARY_DASHBOARD_NUDGE", "false"
buildConfigField "boolean", "DYNAMIC_DASHBOARD_CARDS", "false"
buildConfigField "boolean", "STATS_TRAFFIC_SUBSCRIBERS_TABS", "false"
buildConfigField "boolean", "READER_DISCOVER_NEW_ENDPOINT", "false"
buildConfigField "boolean", "READER_READING_PREFERENCES", "false"
buildConfigField "boolean", "READER_READING_PREFERENCES_FEEDBACK", "false"
buildConfigField "boolean", "READER_TAGS_FEED", "false"
buildConfigField "boolean", "READER_ANNOUNCEMENT_CARD", "false"
buildConfigField "boolean", "VOICE_TO_CONTENT", "false"
buildConfigField "boolean", "READER_FLOATING_BUTTON", "false"
buildConfigField "boolean", "ENABLE_SELF_HOSTED_USERS", "false"
buildConfigField "boolean", "GRAVATAR_QUICK_EDITOR", "true"
// Override these constants in jetpack product flavor to enable/ disable features
buildConfigField "boolean", "ENABLE_SITE_CREATION", "true"
buildConfigField "boolean", "ENABLE_ADD_SELF_HOSTED_SITE", "true"
buildConfigField "boolean", "ENABLE_SIGNUP", "true"
buildConfigField "boolean", "ENABLE_READER", "true"
buildConfigField "boolean", "ENABLE_CREATE_FAB", "true"
buildConfigField "boolean", "ENABLE_FOLLOWED_SITES_SETTINGS", "true"
buildConfigField "boolean", "ENABLE_WHATS_NEW_FEATURE", "true"
buildConfigField "boolean", "ENABLE_QRCODE_AUTH_FLOW", "true"
buildConfigField "boolean", "ENABLE_OPEN_WEB_LINKS_WITH_JP_FLOW", "true"
buildConfigField "boolean", "BLAZE_MANAGE_CAMPAIGNS", "false"
buildConfigField "boolean", "DASHBOARD_PERSONALIZATION", "false"
buildConfigField "boolean", "ENABLE_SITE_MONITORING", "false"
buildConfigField "boolean", "SYNC_PUBLISHING", "false"
buildConfigField "boolean", "ENABLE_IN_APP_UPDATES", "false"
buildConfigField "boolean", "ENABLE_GUTENBERG_KIT", "false"
buildConfigField "boolean", "ENABLE_GUTENBERG_KIT_THEME_STYLES", "false"
manifestPlaceholders = [magicLinkScheme:"wordpress"]
}
// Gutenberg's dependency - react-native-video is using
// Java API 1.8
compileOptions {
// Enables Java 8+ API desugaring support
coreLibraryDesugaringEnabled true
sourceCompatibility JvmTarget.fromTarget(libs.versions.java.get()).target
targetCompatibility JvmTarget.fromTarget(libs.versions.java.get()).target
}
flavorDimensions = ['app', 'buildType']
productFlavors {
wordpress {
isDefault true
dimension "app"
applicationId "org.wordpress.android"
buildConfigField "boolean", "IS_JETPACK_APP", "false"
buildConfigField "String", "TRACKS_EVENT_PREFIX", '"wpandroid_"'
buildConfigField "String", "PUSH_NOTIFICATIONS_APP_KEY", '"org.wordpress.android"'
buildConfigField "boolean", "ENABLE_QRCODE_AUTH_FLOW", "false"
buildConfigField "boolean", "ENABLE_OPEN_WEB_LINKS_WITH_JP_FLOW", "true"
manifestPlaceholders = [magicLinkScheme:"wordpress"]
}
jetpack {
dimension "app"
applicationId "com.jetpack.android"
buildConfigField "boolean", "IS_JETPACK_APP", "true"
buildConfigField "boolean", "ENABLE_SITE_CREATION", "true"
buildConfigField "boolean", "ENABLE_ADD_SELF_HOSTED_SITE", "true"
buildConfigField "boolean", "ENABLE_SIGNUP", "true"
buildConfigField "boolean", "ENABLE_READER", "true"
buildConfigField "boolean", "ENABLE_CREATE_FAB", "true"
buildConfigField "boolean", "ENABLE_FOLLOWED_SITES_SETTINGS", "true"
buildConfigField "boolean", "ENABLE_WHATS_NEW_FEATURE", "true"
buildConfigField "String", "TRACKS_EVENT_PREFIX", '"jpandroid_"'
buildConfigField "String", "PUSH_NOTIFICATIONS_APP_KEY", '"com.jetpack.android"'
buildConfigField "boolean", "ENABLE_QRCODE_AUTH_FLOW", "true"
buildConfigField "boolean", "ENABLE_OPEN_WEB_LINKS_WITH_JP_FLOW", "false"
manifestPlaceholders = [magicLinkScheme:"jetpack"]
// Limit string resources to Mag16 only for Jetpack
// Note 1: this only affects included _locales_; variants for `values-night`, `values-land` and other configs are _still_ preserved in Jetpack and not filtered by this.
resourceConfigurations = ["ar", "de", "es", "fr", "he", "id", "it", "ja", "ko", "nl", "pt-rBR", "ru", "sv", "tr", "zh-rCN", "zh-rTW"]
// Note 2: `in` is the legacy locale code for `id` and `iw` is the legacy locale code for `he`.
// We need to include those to make sure users with older Android versions and still using those legacy codes still have those translations show up at runtime.
resourceConfigurations += ["in", "iw"]
}
// Used for release/beta testing builds. Usually shouldn't be build locally.
// AppName: WordPress/Jetpack
vanilla {
dimension "buildType"
buildConfigField "boolean", "ENABLE_DEBUG_SETTINGS", "false"
}
// Used for local development - preferred variant for developers.
// AppName: WordPress Beta/Jetpack Beta
wasabi {
isDefault true
applicationIdSuffix ".beta"
dimension "buildType"
}
// Used for CI builds on PRs (aka "Prototype Builds"). Can be used locally when a developer needs to install multiple versions of the app on the same device.
// AppName: WordPress Pre-Alpha/Jetpack Pre-Alpha
jalapeno {
applicationIdSuffix ".prealpha"
dimension "buildType"
}
// Also dynamically add additional `buildConfigFields` to our app flavors from any `wp.`/`jp.`-prefixed property in `secrets.properties`
addBuildConfigFieldsFromPrefixedProperties(wordpress, secretProperties, ['wp'])
addBuildConfigFieldsFromPrefixedProperties(jetpack, secretProperties, ['wp', 'jp']) // Inherit same properties used from WP first then overwrite with JP-specific ones
}
buildTypes {
release {
// Proguard is used to shrink our apk, and reduce the number of methods in our final apk,
// but we don't obfuscate the bytecode.
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
}
debug {
minifyEnabled false
pseudoLocalesEnabled true
}
}
signingConfigs {
if (["uploadStoreFile", "uploadStorePassword", "uploadKeyAlias", "uploadKeyPassword"].count { !secretProperties.containsKey(it) } == 0) {
logger.info("App signing properties found in secrets.properties, configuring signing for release builds.")
release {
storeFile = rootProject.file(secretProperties.get("uploadStoreFile"))
storePassword = secretProperties.get("uploadStorePassword")
keyAlias = secretProperties.get("uploadKeyAlias")
keyPassword = secretProperties.get("uploadKeyPassword")
}
android.buildTypes.release.signingConfig = android.signingConfigs.release
}
if (secretProperties.containsKey("debugStoreFile")) {
logger.info("Debug signing properties found in secrets.properties, configuring signing for debug builds.")
def sharedDebugStore = file(secretProperties.get("debugStoreFile").replaceFirst("^~", System.getProperty("user.home")))
if (sharedDebugStore.exists()) {
debug {
storeFile sharedDebugStore
}
}
}
}
testOptions {
animationsDisabled = true
unitTests {
includeAndroidResources = true
returnDefaultValues = true
}
}
lint {
warningsAsErrors = true
checkDependencies = true
checkGeneratedSources = true
lintConfig file("${project.rootDir}/config/lint/lint.xml")
baseline file("${project.rootDir}/config/lint/baseline.xml")
sarifReport = gradle.ext.isCi
}
packagingOptions {
// MPAndroidChart uses androidX - remove this line when we migrate everything to androidX
exclude 'META-INF/proguard/androidx-annotations.pro'
// Exclude React Native's JSC and Fabric JNI
exclude '**/libjscexecutor.so'
exclude '**/libfabricjni.so'
// Avoid React Native's JNI duplicated classes
pickFirst '**/libc++_shared.so'
pickFirst '**/libfbjni.so'
pickFirst 'META-INF/-no-jdk.kotlin_module'
}
bundle {
language {
// Don't split language resources for App Bundles.
// This is required to switch language in app.
enableSplit = false
}
}
buildFeatures {
buildConfig true
viewBinding true
compose true
}
}
/// Dynamically add `buildConfigFields` on a given variant/flavor from prefixed properties
/// (This is used to e.g. add every property prefixed `wp.` in `secrets.properties` as a BuildConfigField in the `wordpress` flavor)
///
/// `prefixes` is an array of prefixes to search for, without their `.` dot (e.g. `["wp", "jp"]`).
/// Properties found with prefixes first in that array will be overridden by the ones found with prefixes later in the array.
static def addBuildConfigFieldsFromPrefixedProperties(variant, properties, prefixes) {
// Build a Map of prefixed properties found. Keys in this Map will be lowercased and `.` replaced by `_`
def fields_map = [:]
prefixes.each { prefix ->
properties.each { property ->
if (property.key.toLowerCase().startsWith("${prefix.toLowerCase()}.")) {
def key = property.key.toLowerCase().replace("${prefix.toLowerCase()}.", "").replace(".", "_")
fields_map[key] = property.value
}
}
}
// Then define the found properties as buildConfigFields
fields_map.each {
variant.buildConfigField "String", it.key.toUpperCase(), "\"${it.value}\""
}
}
dependencies {
implementation(libs.androidx.navigation.compose)
compileOnly project(path: ':libs:annotations')
ksp project(':libs:processors')
implementation (project(path:':libs:networking')) {
exclude group: "com.android.volley"
exclude group: 'org.wordpress', module: 'utils'
}
implementation (project(path:':libs:analytics')) {
exclude group: 'org.wordpress', module: 'utils'
}
implementation project(path:':libs:image-editor')
implementation (project(path:':libs:editor')) {
exclude group: 'org.wordpress', module: 'utils'
}
implementation project(':libs:fluxc')
implementation("$gradle.ext.wputilsBinaryPath:${libs.wordpress.utils.get().version}") {
version {
strictly libs.wordpress.utils.get().version
}
}
implementation project(":libs:login")
implementation("$gradle.ext.aboutAutomatticBinaryPath:${libs.versions.automattic.about.get()}")
implementation("$gradle.ext.gutenbergKitBinaryPath:${libs.versions.gutenberg.kit.get()}")
implementation(libs.automattic.rest) {
exclude group: 'com.mcxiaoke.volley'
}
implementation(libs.wordpress.persistent.edittext)
implementation("$gradle.ext.gravatarBinaryPath:${libs.versions.gravatar.get()}")
implementation("$gradle.ext.gravatarQuickEditorBinaryPath:${libs.versions.gravatar.get()}")
implementation(libs.google.play.app.update)
implementation(libs.google.gson)
implementation(libs.androidx.core.main)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.common)
implementation(libs.androidx.lifecycle.runtime)
implementation(libs.androidx.activity.main)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.fragment.main)
implementation(libs.androidx.fragment.ktx)
implementation(libs.androidx.appcompat.main)
implementation(libs.androidx.appcompat.resources)
implementation(libs.androidx.cardview)
implementation(libs.androidx.recyclerview)
implementation(libs.google.material)
implementation(libs.google.flexboxlayout)
implementation(libs.androidx.percentlayout)
implementation(libs.androidx.swiperefreshlayout)
implementation(libs.androidx.preference)
implementation(libs.androidx.work.runtime)
implementation(libs.androidx.webkit)
implementation(libs.androidx.constraintlayout.main)
implementation(libs.androidx.lifecycle.viewmodel.main)
implementation(libs.androidx.lifecycle.livedata.core)
implementation(libs.androidx.lifecycle.livedata.main)
implementation(libs.androidx.lifecycle.process)
implementation(libs.android.volley)
implementation(libs.google.play.review)
implementation(libs.google.play.services.auth)
implementation(libs.google.mlkit.barcode.scanning.common)
implementation(libs.google.mlkit.text.recognition)
implementation(libs.google.mlkit.barcode.scanning.main)
// CameraX
implementation(libs.androidx.camera.camera2)
implementation(libs.androidx.camera.lifecycle)
implementation(libs.androidx.camera.view)
implementation(libs.android.installreferrer)
implementation(libs.photoview)
implementation(libs.greenrobot.eventbus.main)
implementation(libs.greenrobot.eventbus.java)
implementation(libs.squareup.retrofit)
implementation(libs.apache.commons.text)
implementation(libs.airbnb.lottie.main)
implementation(libs.facebook.shimmer)
implementation(libs.automattic.ucrop) {
exclude group: 'androidx.core', module: 'core'
exclude group: 'androidx.constraintlayout', module: 'constraintlayout'
exclude group: 'androidx.appcompat', module: 'appcompat'
}
implementation(libs.bumptech.glide.main)
ksp(libs.bumptech.glide.ksp)
implementation(libs.bumptech.glide.volley.integration)
implementation(libs.indexos.media.for.mobile.domain)
implementation(libs.indexos.media.for.mobile.android)
implementation(libs.zendesk.support)
implementation files('../aars/tenor-android-core-jetified.aar') // Jetified Tenor Gif library
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.mpandroidchart)
implementation(libs.jsoup)
implementation(libs.google.exoplayer) {
exclude group: 'com.android.support', module: 'support-annotations'
}
implementation(libs.google.dagger.android.support)
ksp(libs.google.dagger.android.processor)
implementation(libs.google.dagger.hilt.android.main)
ksp(libs.google.dagger.hilt.compiler)
implementation(libs.wordpress.rs.android)
testImplementation(libs.androidx.arch.core.testing) {
exclude group: 'com.android.support', module: 'support-compat'
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-core-utils'
}
testImplementation(libs.junit)
androidTestImplementation(libs.mockito.android)
testImplementation(libs.mockito.kotlin)
testImplementation(libs.kotlin.test.junit)
testImplementation(libs.assertj.core)
testImplementation(libs.kotlinx.coroutines.test)
androidTestImplementation project(path:':libs:mocks')
androidTestImplementation(libs.mockito.kotlin)
androidTestImplementation(libs.androidx.test.uiautomator)
androidTestImplementation(libs.androidx.test.espresso.core) {
version {
strictly libs.androidx.test.espresso.core.get().version
}
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestImplementation(libs.androidx.test.espresso.contrib) {
version {
strictly libs.androidx.test.espresso.contrib.get().version
}
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'recyclerview-v7'
}
androidTestImplementation(libs.androidx.test.espresso.accessibility) {
version {
strictly libs.androidx.test.espresso.accessibility.get().version
}
}
androidTestImplementation(libs.androidx.test.main.runner)
androidTestImplementation(libs.androidx.test.main.rules)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.fastlane.screengrab) {
exclude group: 'com.android.support.test.uiautomator', module: 'uiautomator-v18'
}
androidTestImplementation files('../aars/cloudtestingscreenshotter_lib.aar') // Screenshots on Firebase Cloud Testing
androidTestImplementation(libs.androidx.work.testing)
androidTestImplementation(libs.google.dagger.hilt.android.testing)
kspAndroidTest(libs.google.dagger.hilt.android.compiler)
// Enables Java 8+ API desugaring support
coreLibraryDesugaring(libs.android.desugar)
lintChecks(libs.wordpress.lint)
// Firebase
implementation(platform(libs.google.firebase.bom))
// Firebase - Main
implementation(libs.google.firebase.messaging)
// Firebase - Deprecated
implementation(libs.google.firebase.iid)
// Jetpack Compose
implementation(platform(libs.androidx.compose.bom))
androidTestImplementation(platform(libs.androidx.compose.bom))
// - Jetpack Compose - Android Studio
debugImplementation(libs.androidx.compose.ui.test.manifest)
debugImplementation(libs.androidx.compose.ui.tooling.main)
// - Jetpack Compose - Main
implementation(libs.androidx.compose.runtime.main)
implementation(libs.androidx.compose.runtime.livedata)
implementation(libs.androidx.compose.foundation.main)
implementation(libs.androidx.compose.foundation.layout)
implementation(libs.androidx.compose.ui.main)
implementation(libs.androidx.compose.ui.graphics)
implementation(libs.androidx.compose.ui.text)
implementation(libs.androidx.compose.ui.unit)
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(libs.androidx.compose.material)
// - Jetpack Compose - AndroidX
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.constraintlayout.compose)
// - Jetpack Compose - Other
implementation(libs.coil.compose)
implementation(libs.coil.video)
implementation(libs.airbnb.lottie.compose)
// - Jetpack Compose - UI Tests
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
implementation(libs.androidx.compose.material3)
// Cascade - Compose nested menu
implementation(libs.cascade.compose)
implementation(libs.automattic.tracks.crashlogging)
lintChecks(libs.android.security.lint)
}
dependencyAnalysis {
issues {
onUnusedDependencies {
// This dependency is actually needed otherwise the app will crash with a runtime exception.
exclude(libs.greenrobot.eventbus.main.get().module.toString())
// This dependency is actually needed because otherwise UI tests fail to run (but do compile).
exclude(libs.mockito.android.get().module.toString())
}
}
}
configurations.all {
// Exclude packaged wordpress sub projects, force the use of the source project
// (eg. use :libs:utils:WordPressUtils instead of 'org.wordpress:utils')
exclude group: 'org.wordpress', module: 'analytics'
}
// If Google services file doesn't exist, copy example file
if (!file("google-services.json").exists()) {
copy {
from(".")
into(".")
include("google-services.json-example")
rename('google-services.json-example', 'google-services.json')
}
}
// Print warning message if example Google services file is used.
if ((file('google-services.json').text) == (file('google-services.json-example').text)) {
println("WARNING: You're using the example google-services.json file. Google login will fail.")
}
tasks.register("printVersionName") {
def versionName = android.defaultConfig.versionName
doLast {
println versionName
}
}
tasks.register("printAllVersions") {
def versions = android.applicationVariants.collect {
[it.name, it.versionName, it.versionCode]
}
doLast {
versions.each { name, versionName, versionCode ->
println "$name: $versionName ($versionCode)"
}
}
}
tasks.register("printResourceConfigurations") {
def flavorInfo = android.productFlavors
.findAll { it.dimension == "app" }
.collect { [it.name, it.resourceConfigurations] }
doLast {
flavorInfo.each { name, resourceConfigurations ->
println "$name: $resourceConfigurations"
}
}
}
android {
// Enable per-app language support
// https://developer.android.com/guide/topics/resources/app-languages
androidResources {
generateLocaleConfig = true
}
// Copy React Native JavaScript bundle and source map so they can be upload it to the Crash logging
// service during the build process.
applicationVariants.configureEach { variant ->
def variantAssets = variant.mergeAssetsProvider.get().outputDir.get()
tasks.register("delete${variant.name.capitalize()}ReactNativeBundleSourceMap", Delete) {
delete(fileTree(dir: variantAssets, includes: ['**/*.bundle.map']))
}
tasks.register("copy${variant.name.capitalize()}ReactNativeBundleSourceMap", Copy) {
from(variantAssets)
into("${buildDir}/react-native-bundle-source-map")
include("*.bundle", "*.bundle.map")
finalizedBy("delete${variant.name.capitalize()}ReactNativeBundleSourceMap")
}
variant.mergeAssetsProvider.configure {
finalizedBy("copy${variant.name.capitalize()}ReactNativeBundleSourceMap")
}
}
}