Repository navigation
Conversation
…onMain Moves 90 files whose code compiles for jvm unchanged: ui:components 37, app:core 27, core-ui 9, shared:tokens 7, ui:core 5, ui:navigation 3, common-ui 1, theme 1. Six modules get the Compose (and, for app:core, libsodium) artifacts on commonMain so the moved files resolve. Each file was moved, compiled for jvm, and moved back if it failed, so no code changed. What stays in androidMain references R, Hilt, java.*, Android APIs, or a neighbour that does.
…files 13 files that were held in androidMain only by `R` move to commonMain (core-ui 6, ui:components 4, common-ui 2, app:core 1). They read strings and drawables through the generated `Res` with org.jetbrains.compose.resources, on Android as well as desktop, so no Int-id seam is added. ui:components and common-ui gain the Compose resources plugin with the same res-sync block app:core uses. ui:components gets the multiplatform material icons on commonMain and core-ui gets shared:theme there. UnreadSeparator stays in androidMain: its plural items point at other strings with @string/, which Compose resources does not resolve. ComposeResourcesOnAndroidTest renders a converted string and vector under Robolectric, since a missing Compose resource throws at runtime rather than failing the build.
Common code read strings and icons through stringRes/painterForResId and per-module id objects (CoreStrings, CoreDrawables, TxStrings, FlagStrings), each an expect object with R on Android and Compose ids on jvm. Call sites now use Res.string.x / Res.drawable.x directly and the id objects are gone. - ResourceHelper gains getString(StringResource, args). The transaction mappers build text outside composition, so Android maps the resource key back to R and jvm calls getString. ResourceHelperStringResourceTest checks the Android path finds the real string. - shared:userflags gets Compose resources; Field.label/hint are StringResource, and the Android-only editor reads them with stringResource. - Currency flags are still looked up by name at runtime on jvm, so ComposeResourceIds stays for the name-keyed ResourceHelper.
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.
Stacked on #1844. Moves source files out of androidMain wherever they compile for every target as-is, in the modules this stack already converted to KMP. It converts no new modules.
Pass 1, mechanical (2fa0c04): 90 files across 8 modules. Each file was moved, compiled for jvm, and moved back on failure, so no code changed. Six build files gain Compose (and libsodium in app:core) on commonMain.
What stays references
R, Hilt,java.*, Android APIs (Context, Uri, Bitmap, Navigation3), or a neighbour in the same package that does. Pass 2,Rto Compose resources (1d77df4): 13 more files (core-ui 6, ui:components 4, common-ui 2, app:core 1). They read the generatedResthroughorg.jetbrains.compose.resourceson both platforms, so Android now loads these strings and icons from Compose resources instead ofR.ComposeResourcesOnAndroidTestrenders one string and one vector under Robolectric to show they resolve on Android at runtime.The other
Rfiles stay because they also need an androidMain-only neighbour, take@DrawableRes Int/@StringRes Intparameters that would change caller signatures, or use a plural whose items are@string/references (UnreadSeparator), which Compose resources don't resolve.Pass 3, the Int-id lookups (597c412):
stringRes/painterForResIdand the per-module id objects (CoreStrings,CoreDrawables,TxStrings,FlagStrings) are gone; call sites readRes.string.x/Res.drawable.x. The transaction mappers build text outside composition, soResourceHelper.getString(StringResource, args)maps the key back toRon Android, andResourceHelperStringResourceTestchecks that path returns the real string.shared:userflagsgains Compose resources andField.label/hintbecomeStringResource.ComposeResourceIdsstays on jvm for the name-keyed currency-flag lookup.If one PR is easier to review, this can fold into #1844.