Rework resource generation#881
Open
ExNDY wants to merge 19 commits into
Open
Conversation
Release 0.26.4
Contributor
Author
|
on current time, i need ask about metadata.json files, after rework generation this structure little bit simple than generated files and i dont know what is next: its correct "info about resources" or need rework metadata for all generated objects @Alex009 can i ask your help here |
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.
Summary
This PR reworks resource code generation to use batched accessors and a cleaner split between common generation logic and platform-specific initialization.
The main idea is that generated accessors are no longer emitted as one large monolithic block per resource type. Instead, resources are split into internal batches, while the public MR-facing API remains stable and aggregates those batches through
values(). This reduces generated file size, simplifies platform-specific generators, and makes the generated structure easier to evolve.The PR also includes:
GenerateMultiplatformResourcesTask;What Changed
1. Batched generated accessors
ResourceTypeGeneratornow chunks resources into batches and generates internal grouped accessor objects such asCommonMainStrings0,CommonMainStrings1, etc.values();This gives us a cleaner separation of responsibilities:
2. Apple SVG opacity fix (
#731)#RRGGBBAAand#RGBA;fill-opacityandstroke-opacitybefore the file is written into the generated Apple asset catalog.Example:
fill="#a3acb1a4"becomesfill="#a3acb1" fill-opacity="0.64"This keeps the rendered appearance while producing SVG content that Apple handles more reliably, including in simulator runs.
3. Relocatable build cache fix
Fixed the relocatable build cache for
GenerateMultiplatformResourcesTask:upperSourceSetsis no longer included in the cache key as a regular@Inputbecause it contained absolute paths to the source set resources. It is now marked as@Internal, so identical builds from different checkout paths can reuse the build cache.Additionally, the generated MR
contentHashis now a publicconst val, so resource changes become part of the public ABI and downstream Java/Gradle compilation can detect them more accurately.Manual Verification
Tested manually:
:resources-generator:compileKotlinpasses.compose-resources-gallery, modifyingappleMainno longer invalidatescommonMain/nativeMain, and only regenerates the necessary chain:appleMain -> iosMain -> iosSimulatorArm64Main./private/tmp/...paths showedFROM-CACHEforgenerateMR...tasks.fixed issue: #731 , #810