check lokalize generated translation sources into the tree#1827
Draft
VishnuSanal wants to merge 1 commit into
Draft
check lokalize generated translation sources into the tree#1827VishnuSanal wants to merge 1 commit into
VishnuSanal wants to merge 1 commit into
Conversation
- multipaz-doctypes and multipaz-utopia now commit their rendered sourcesunder src/commonMain/generated/ (GeneratedTranslations, per language Strings_*, and GeneratedStringKeys). Compiling reads them directly and no longer regenerates. - generateMultipazStrings now writes into that committed directory on demand rather than into build/ on every compile. Run it after editing strings. - lokalizeCheckGenerated renders in memory and fails the build (with the fix command) if the committed sources drift from strings.json. It is wired into check, so ./gradlew build enforces it — including in CI (unit-test.yml). - Remove the legacy build/-generation mode and its configureEach block; with both JSON modules checked in there are no users left, which eliminates the configuration-time lag. generatedSourceDir is demoted from a mode toggle to a convention-defaulted override (src/commonMain/generated). - multipaz-compose is unchanged in behavior: it is an XML module that resolves strings through Compose Resources at runtime and generates no Kotlin, so generateMultipazStrings skips for it. Its dead androidReleaseSourcesJar dependsOn hack is removed too. - .gitattributes marks the generated tree linguist-generated so it collapses in diffs and is never hand-edited. Signed-off-by: VishnuSanal <vishnusanalt@gmail.com>
Contributor
|
Looks good to me |
hanluOMH
approved these changes
Jul 20, 2026
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.
Fixes #1811
Translation sources rendered by the lokalize plugin from
values*/strings.jsonare now checked into the tree instead of generated into
build/on everycompile. This fixes two things:
generated Kotlin (
GeneratedTranslations,Strings_*,GeneratedStringKeys)only existed after a Gradle build, so a plain source checkout didn't compile.
configureEachblock realized every task in the project just to wire thegenerator onto the compile path. With generation off the compile path, it's
gone.
What changed
Checked-in modules (
multipaz-doctypes,multipaz-utopia)src/commonMain/generated/.generateMultipazStringswrites there on demand (run it after editing strings); compiling no longer regenerates.lokalizeCheckGeneratedrenders in memory and fails the build if the committed sources drift fromstrings.json, printing the exact regen command. It's wired intocheck, so./gradlew buildenforces it — including CI (unit-test.ymlrunsbuild).Plugin
build/-generation mode and itsconfigureEachblock deleted (zero users remain once both JSON modules are checked in).generatedSourceDirdemoted from a mode toggle to a convention-defaulted override (src/commonMain/generated).outputDirroutes XML modules to a throwawaybuild/path so a skipped run never touchessrc/.multipaz-compose(unchanged behavior)generateMultipazStringsskips.androidReleaseSourcesJar dependsOn generateMultipazStringshack..gitattributes*/src/commonMain/generated/**linguist-generated=trueso it collapses in diffs and signals it's never hand-edited.How the safety net works
strings.json(source of truth, committed) →generateMultipazStrings→src/commonMain/generated/*.kt(committed).lokalizeCheckGenerated(incheck) guarantees the two never diverge on a merged PR.Testing
./gradlew :multipaz-doctypes:lokalizeCheckGenerated :multipaz-utopia:lokalizeCheckGenerated— both pass (
✓ Generated strings are up to date (23 languages)).strings.jsonmakes the drift check fail with the fix command; regenerating restores green.build/wiped); KSP (kspCommonMainKotlinMetadata) andjvmTestpass;build/generated/kmpnever reappears for the JSON modules.generateMultipazStringsis off every compile andsourcesJarpath.multipaz-composesource tree stays pristine — the skipped generator writes nothing undersrc/.