Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ pluginManager.withPlugin("com.android.application") {
minSdk = project.property("ANDROID_MIN_SDK_VERSION").toString().toInt()
targetSdk = project.property("ANDROID_TARGET_SDK_VERSION").toString().toInt()

// en_XA and ar_XB are pseudolocales for debugging.
// The rest of the locales provides an explicit list of the languages to keep in the
// final app. Doing this will strip out additional locales from libraries like
// Google Play Services and Firebase, which add unnecessary bloat.
resourceConfigurations.addAll(listOf("en", "en-rUS", "en-rGB", "en-rAU", "es", "en_XA", "ar_XB"))

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

testInstrumentationRunnerArguments["useTestStorageService"] = "true"
Expand All @@ -27,27 +21,34 @@ pluginManager.withPlugin("com.android.application") {
}
}
}
project.the<com.android.build.api.dsl.ApplicationExtension>().apply {
// en-rXA and ar-rXB are pseudolocales for debugging.
// The rest of the locales provides an explicit list of the languages to keep in the
// final app. Doing this will strip out additional locales from libraries like
// Google Play Services and Firebase, which add unnecessary bloat.
// localeFilters validates every entry and rejects the "en_XA" form that
// resourceConfigurations accepted, so the pseudolocales use the "-r" region qualifier.
@Suppress("UnstableApiUsage")
androidResources {
localeFilters += listOf("en", "en-rUS", "en-rGB", "en-rAU", "es", "en-rXA", "ar-rXB")
}
}
}

pluginManager.withPlugin("com.android.library") {
project.the<com.android.build.gradle.LibraryExtension>().apply {
configureBaseExtension()

// No locale stripping here. localeFilters is only available on ApplicationAndroidResources,
// and the application module's filter already applies to the resources merged in from
// libraries at packaging time.
defaultConfig {
minSdk = project.property("ANDROID_MIN_SDK_VERSION").toString().toInt()
// This is deprecated but we don't have a replacement for the instrumentation APKs yet
// TODO [#1815]: Gradle targetSdk deprecated #1815
// TODO [#1815]: https://github.com/Electric-Coin-Company/zashi-android/issues/1815
targetSdk = project.property("ANDROID_TARGET_SDK_VERSION").toString().toInt()

// The last two are for support of pseudolocales in debug builds.
// If we add other localizations, they should be included in this list.
// By explicitly setting supported locales, we strip out unused localizations from third party
// libraries (e.g. play services)
// TODO [#1816]: Gradle resourceConfigurations deprecation #1816
// TODO [#1816]: https://github.com/Electric-Coin-Company/zashi-android/issues/1816
resourceConfigurations.addAll(listOf("en", "en-rUS", "en-rGB", "en-rAU", "es", "en_XA", "ar_XB"))

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("proguard-consumer.txt")

Expand All @@ -66,18 +67,12 @@ pluginManager.withPlugin("com.android.test") {
project.the<com.android.build.gradle.TestExtension>().apply {
configureBaseExtension()

// No locale stripping here either. The test APKs target :app and don't ship locale
// resources of their own, and localeFilters isn't available on TestAndroidResources.
defaultConfig {
minSdk = project.property("ANDROID_MIN_SDK_VERSION").toString().toInt()
targetSdk = project.property("ANDROID_TARGET_SDK_VERSION").toString().toInt()

// The last two are for support of pseudolocales in debug builds.
// If we add other localizations, they should be included in this list.
// By explicitly setting supported locales, we strip out unused localizations from third party
// libraries (e.g. play services)
// TODO [#1816]: Gradle resourceConfigurations deprecation #1816
// TODO [#1816]: https://github.com/Electric-Coin-Company/zashi-android/issues/1816
resourceConfigurations.addAll(listOf("en", "en-rUS", "en-rGB", "en-rAU", "es", "en_XA", "ar_XB"))

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

testInstrumentationRunnerArguments["useTestStorageService"] = "true"
Expand Down