Skip to content

Commit 3b1e398

Browse files
committed
fix(kmp): wire KMP modules' testAndroidHostTest into flipcashTestDebug
KMP library modules (com.android.kotlin.multiplatform.library + withHostTest {}) expose `testAndroidHostTest`, not the `testDebugUnitTest` that com.android.library modules expose. The flipcashTestDebug aggregate only bucketed modules into android (`testDebugUnitTest`) and pure-JVM (`test`), so once base58 became a KMP module (#1201) it landed in the android bucket and the aggregate depended on a non-existent `:libs:encryption:base58:testDebugUnitTest` — silently skipping / breaking the base58 vector gate in the aggregate. This PR's sha256/sha512/hmac KMP conversions would extend the same fault. Add a kmpUnitTestModules list (base58 + sha256/sha512/hmac), exclude it from the android bucket, exclude the testless :kmp:shared-core umbrella, and depend on `testAndroidHostTest` for the KMP modules so their host tests run in the aggregate. Verified: `./gradlew flipcashTestDebug --dry-run` resolves the full task graph (exit 0) with the KMP host-test tasks wired in.
1 parent 2556ccd commit 3b1e398

2 files changed

Lines changed: 23 additions & 7 deletions

File tree

‎build.gradle.kts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,18 @@ dependencies {
6666
// Isolated Projects forbids. The module lists come from `settings.gradle.kts`; the
6767
// task depends on each module's test task by *path* — a lazy, cross-project-safe
6868
// dependency that never configures the other project at configuration time.
69-
// Android modules expose `testDebugUnitTest`; pure-JVM modules expose `test`.
69+
// Android modules expose `testDebugUnitTest`; KMP modules expose `testAndroidHostTest`;
70+
// pure-JVM modules expose `test`.
7071
@Suppress("UNCHECKED_CAST")
7172
val androidUnitTestModules = rootProject.extra["flipcash.androidUnitTestModules"] as List<String>
7273
@Suppress("UNCHECKED_CAST")
7374
val jvmUnitTestModules = rootProject.extra["flipcash.jvmUnitTestModules"] as List<String>
75+
@Suppress("UNCHECKED_CAST")
76+
val kmpUnitTestModules = rootProject.extra["flipcash.kmpUnitTestModules"] as List<String>
7477

7578
tasks.register("flipcashTestDebug") {
7679
description = "Run testDebug for all Flipcash modules"
7780
dependsOn(androidUnitTestModules.map { "$it:testDebugUnitTest" })
7881
dependsOn(jvmUnitTestModules.map { "$it:test" })
82+
dependsOn(kmpUnitTestModules.map { "$it:testAndroidHostTest" })
7983
}

‎settings.gradle.kts‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,17 +239,27 @@ val koverModules = includedProjectPaths.filter { path ->
239239
koverPaths.any { path == it || path.startsWith("$it:") } && path !in nonKoverModules
240240
}
241241

242-
// Aggregate unit tests: :apps:flipcash, service modules, and :libs (which holds the host-JVM
243-
// cross-platform vector gate for base58 + any future pure-JVM lib tests). Android modules expose
244-
// `testDebugUnitTest`; pure-JVM modules expose `test`; the androidTest `:benchmark` module has
245-
// no unit-test task.
242+
// Aggregate unit tests: :apps:flipcash, service modules, :libs (host-JVM cross-platform vector
243+
// gates + pure-JVM lib tests), and :kmp. Android library modules expose `testDebugUnitTest`;
244+
// KMP modules (`com.android.kotlin.multiplatform.library` + `withHostTest {}`) expose
245+
// `testAndroidHostTest`; pure-JVM modules expose `test`; `:benchmark` is androidTest-only and the
246+
// `:kmp:shared-core` umbrella has no tests of its own.
246247
val unitTestPaths = listOf(":apps:flipcash", ":services:flipcash", ":services:opencode", ":libs", ":kmp")
247248
val jvmUnitTestModules = setOf(":apps:flipcash:shared:ksp")
248-
val noUnitTestModules = setOf(":apps:flipcash:benchmark")
249+
// KMP modules run their host tests via `testAndroidHostTest`, not `testDebugUnitTest`.
250+
val kmpUnitTestModules = setOf(
251+
":libs:encryption:base58",
252+
":libs:encryption:sha256",
253+
":libs:encryption:sha512",
254+
":libs:encryption:hmac",
255+
)
256+
val noUnitTestModules = setOf(":apps:flipcash:benchmark", ":kmp:shared-core")
249257
val unitTestCandidates = includedProjectPaths.filter { path ->
250258
unitTestPaths.any { path == it || path.startsWith("$it:") } && path !in noUnitTestModules
251259
}
252-
val androidUnitTestModules = unitTestCandidates.filter { it !in jvmUnitTestModules }
260+
val androidUnitTestModules = unitTestCandidates.filter {
261+
it !in jvmUnitTestModules && it !in kmpUnitTestModules
262+
}
253263

254264
// Forced dependency versions for the per-project configuration below. The
255265
// version catalog isn't registered on projects yet at `beforeProject` time, so
@@ -277,6 +287,7 @@ run {
277287
val koverModulesForRoot = koverModules.toList()
278288
val androidUnitTestForRoot = androidUnitTestModules.toList()
279289
val jvmUnitTestForRoot = jvmUnitTestModules.toList()
290+
val kmpUnitTestForRoot = kmpUnitTestModules.toList()
280291
val forcedDependencies = listOf(
281292
"org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVersion",
282293
"org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion",
@@ -287,6 +298,7 @@ run {
287298
extra["flipcash.koverModules"] = koverModulesForRoot
288299
extra["flipcash.androidUnitTestModules"] = androidUnitTestForRoot
289300
extra["flipcash.jvmUnitTestModules"] = jvmUnitTestForRoot
301+
extra["flipcash.kmpUnitTestModules"] = kmpUnitTestForRoot
290302
}
291303

292304
configurations.configureEach {

0 commit comments

Comments
 (0)