Skip to content

Commit

Permalink
Update resource configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
ychescale9 committed Sep 26, 2024
1 parent 9b428a3 commit 1c4fea8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import com.android.build.api.variant.HasUnitTestBuilder
import com.android.build.api.variant.LibraryAndroidComponentsExtension
import com.android.build.gradle.TestExtension
import com.android.build.gradle.TestedExtension
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.kotlin.dsl.the
import java.io.File

/**
* Apply baseline configurations on an Application or Library project.
Expand All @@ -22,9 +24,6 @@ internal fun TestedExtension.configureCommonAndroidExtension(project: Project) {
defaultConfig {
minSdk = AndroidSdk.minSdk
targetSdk = AndroidSdk.targetSdk

// only support English for now
resourceConfigurations.add("en")
}

testOptions.animationsDisabled = true
Expand All @@ -51,6 +50,27 @@ internal fun TestedExtension.configureCommonAndroidExtension(project: Project) {
}
}

/**
* Apply baseline configurations on an Application project.
*/
internal fun BaseAppModuleExtension.configureAndroidApplicationExtension(project: Project) {
androidResources {
@Suppress("UnstableApiUsage")
localeFilters += "en"
}

lint {
quiet = false
ignoreWarnings = false
htmlReport = true
xmlReport = true
htmlOutput = File("${project.layout.buildDirectory.get()}/reports/lint/lint-reports.html")
xmlOutput = File("${project.layout.buildDirectory.get()}/reports/lint/lint-reports.xml")
checkDependencies = true
ignoreTestSources = true
}
}

/**
* Apply baseline configurations on an Android Test project.
*/
Expand All @@ -61,9 +81,6 @@ internal fun TestExtension.configureAndroidTestExtension() {
defaultConfig {
minSdk = AndroidSdk.minSdk
targetSdk = AndroidSdk.targetSdk

// only support English for now
resourceConfigurations.add("en")
}

compileOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.github.reactivecircus.kstreamlined.buildlogic.convention

import com.android.build.api.variant.ApplicationAndroidComponentsExtension
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
import io.github.reactivecircus.kstreamlined.buildlogic.configureAndroidApplicationExtension
import io.github.reactivecircus.kstreamlined.buildlogic.configureAndroidApplicationVariants
import io.github.reactivecircus.kstreamlined.buildlogic.configureCommonAndroidExtension
import io.github.reactivecircus.kstreamlined.buildlogic.configureDetekt
Expand All @@ -12,7 +13,6 @@ import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
import java.io.File

internal class AndroidApplicationConventionPlugin : Plugin<Project> {
override fun apply(target: Project) = with(target) {
Expand All @@ -27,17 +27,7 @@ internal class AndroidApplicationConventionPlugin : Plugin<Project> {

extensions.configure<BaseAppModuleExtension> {
configureCommonAndroidExtension(target)

lint {
quiet = false
ignoreWarnings = false
htmlReport = true
xmlReport = true
htmlOutput = File("${project.layout.buildDirectory.get()}/reports/lint/lint-reports.html")
xmlOutput = File("${project.layout.buildDirectory.get()}/reports/lint/lint-reports.xml")
checkDependencies = true
ignoreTestSources = true
}
configureAndroidApplicationExtension(target)
}

extensions.configure<ApplicationAndroidComponentsExtension> {
Expand Down

0 comments on commit 1c4fea8

Please sign in to comment.