Uh oh!
There was an error while loading. Please reload this page.
refactor(build-logic): extract the KMP test-fixture generator into a convention plugin - #1293
Merged
Merged
Conversation
…convention plugin `libs/encryption/base58` and `libs/codes/kikcode` each carried a byte-identical copy of `GenerateTestFixtures`, differing only in the package the generated file is declared in, plus an identical block wiring the AGP lint tasks to depend on the generator. That copy-paste broke `code/cash` once already: #1288 added the lint wiring to kikcode, then #1289 introduced the same generator in base58 without it, and lint failed over an undeclared dependency on generated sources. Adding the source directory only carries the dependency to the Kotlin compile tasks -- lint reads the same directories straight off disk -- so the wiring is easy to forget and invisible until CI runs. Move the task into `build-logic` behind a `flipcash.kmp.test.fixtures` convention plugin. The plugin takes the package via a `testFixtures {}` extension, registers the generated directory on `commonTest`, and wires the lint dependency itself, so a module that applies it cannot omit it. Both modules drop from ~75 lines of build script to four.
Uh oh!
There was an error while loading. Please reload this page.
bmc08gt added a commit
that referenced
this pull request
Aug 21, 2026
…esign * origin/code/cash: fix(core): add \ to escape ' in What's (#1298) feat(shared-core): wrap the framework in a Swift target (#1297) chore: update display name entry title/hint (#1296) ci(shared-core): write a placeholder local.properties before publishing (#1295) build(shared-core): publish the XCFramework to flipcash-shared-core-spm (#1294) refactor(build-logic): extract the KMP test-fixture generator into a convention plugin (#1293) build(base58): declare the base58 lint tasks' dependency on generated fixtures (#1292) test(base58): run the vector gate on Kotlin/Native, not just the JVM (#1289) build(codes): declare the kikcode lint tasks' dependency on generated fixtures (#1288) # Conflicts: # apps/flipcash/core/src/main/res/values/strings.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
libs/encryption/base58/build.gradle.ktsandlibs/codes/kikcode/build.gradle.ktseach carried a byte-identical copy ofGenerateTestFixtures— differing only in the package the generated file is declared in (com.getcode.vendorvscom.getcode.codes.kikcode) — plus an identical block wiring the AGP lint tasks to the generator:tasks.matching { it.name.startsWith("lint") || it.name.endsWith("LintModel") } .configureEach { dependsOn(generateTestFixtures) }That copy-paste already broke
code/cashonce. #1288 added the lint wiring to kikcode; #1289 then introduced the same generator in base58 without it, and lint failed over an undeclared dependency on generated sources (fixed in #1292).The failure mode is easy to hit:
kotlin.srcDir(taskProvider)carries the task dependency to the Kotlin compile tasks only, while lint reads the same source directories straight off disk. Nothing about copying the generator suggests the extra wiring is needed, and it's invisible until CI runs lint.Change
Move the task into
build-logicbehind a newflipcash.kmp.test.fixturesconvention plugin:GenerateTestFixtures— the task, unchanged apart from the package becoming a@get:Inputproperty. The output path is derived from it, socom.getcode.vendorstill lands atcom/getcode/vendor/TestFixtures.kt.TestFixturesExtension—packageName(required) andfixtures(defaults tosrc/commonTest/resources).KmpTestFixturesConventionPlugin— registers the task, adds the generated directory tocommonTest, and wires the lint dependency automatically. A module that applies the plugin cannot omit it.Both modules drop from ~75 lines of build script to four:
plugins { kotlin("multiplatform") id("com.android.kotlin.multiplatform.library") alias(libs.plugins.flipcash.kmp.test.fixtures) } testFixtures { packageName ="com.getcode.vendor" }Notes
packageNamehas no default, so a module that applies the plugin and forgets to set it fails with Gradle's standard "property 'packageName' doesn't have a configured value". I opted against defaulting to the Android namespace: base58's namespace (com.getcode.encryption.base58) doesn't match its fixture package (com.getcode.vendor), and a silently-wrong default is worse than a loud missing one.