Skip to content

Commit

Permalink
fix: test for multimodule (#2873)
Browse files Browse the repository at this point in the history
  • Loading branch information
yamilmedina authored Apr 8, 2024
1 parent 319be19 commit 2a11540
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
configureCompose(this)

configureAndroidKotlinTests()

buildTypes {
// submodules using this plugin can skip minification, since the app will do it
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
}
}
}
5 changes: 4 additions & 1 deletion buildSrc/src/main/kotlin/scripts/infrastructure.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ tasks.named<Wrapper>("wrapper") {
tasks.register("runUnitTests") {
description = "Runs all Unit Tests."
dependsOn(":app:test${Default.BUILD_VARIANT}UnitTest")
val buildType =
if (Default.BUILD_TYPE == Variants_gradle.BuildTypes.DEBUG) Default.BUILD_TYPE.capitalized()
else Variants_gradle.BuildTypes.RELEASE.capitalized()

// valid submodules path to run unit tests
val validSubprojects = setOf("core", "features")
rootProject.subprojects {
if (validSubprojects.contains(parent?.name)) {
dependsOn(":${parent?.name}:$name:test${Default.BUILD_TYPE.capitalized()}UnitTest")
dependsOn(":${parent?.name}:$name:test${buildType}UnitTest")
}
}
}
Expand Down

0 comments on commit 2a11540

Please sign in to comment.