Repository navigation
build: name the KSP predicate the two schema rules share - #1714
Merged
Merged
Conversation
Follow-up to #1712, which is where the need showed up. That change added a matcher spelled `startsWith("ksp") && endsWith("Kotlin")` a few lines below one that already existed and read almost identically — and the existing one deliberately INVERTS on the UnitTest/AndroidTest rounds. I did not notice while writing it, which is the argument for this: two near-identical predicates meaning opposite things is a trap regardless of who reads them next. The shared half is now named, and the comment on it states the opposition rather than leaving it to be diffed by eye: isMainSourceSetKspTask excludes those rounds so Gradle is not told they output a directory they never write and then clears it from under the round that did, while syncRoomSchemaSnapshot's mustRunAfter includes them because they still race the Sync. Pure refactor. Both predicates were checked name by name against every KSP and compile task name this project generates, and neither changes for any of them. Verified anyway, because the failure mode here is a missing schema export rather than a compile error: the three-task command from #1712 still succeeds, the debug, unit-test and release rounds still run exactly once each, 4,725 tests pass, and SchemaOracleTest — the test that fails when the export goes missing — is 4 for 4.
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 free
to 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.
Follow-up to #1712, which is where the need showed up.
Why
That change added a matcher spelled
startsWith("ksp") && endsWith("Kotlin")a few lines below one that already existed and read almost identically — and the existing one deliberately inverts on theUnitTest/AndroidTestrounds. I did not notice while writing it, which is the argument for this change rather than against it: two near-identical predicates meaning opposite things is a trap regardless of who reads them next.What
syncRoomSchemaSnapshot'smustRunAfternow callsisKspKotlinTaskdirectly, and the comment on the shared half states the opposition instead of leaving it to be diffed by eye:isMainSourceSetKspTaskexcludes those rounds, so Gradle is not told they output a directory they never write and then clears it out from under the round that did.mustRunAfterincludes them, because they still race the Sync.Pure refactor
Both predicates were checked name by name against every KSP and compile task name this project generates —
kspFullDebugKotlin,kspFullReleaseKotlin, the demo variants, the UnitTest and AndroidTest rounds,kspFullDebugJava,compileFullDebugKotlin. Neither predicate changes for any of them.Verified anyway
The failure mode in this area is a missing schema export, not a compile error, so it does not announce itself:
SchemaOracleTestRun before and after the comment relocation described below, with identical results.
One note on the diff
My first version of this inserted the new declaration between the pre-existing comment block and the function it documents, orphaning the "load-bearing" exclusion rationale onto the wrong function. Caught in review and moved above the block. Worth mentioning because it is the exact hazard this PR exists to reduce — and because a comment attached to the wrong function is invisible to every check in CI.