Skip to content

#651 test source set resources - #896

Open
ExNDY wants to merge 12 commits into
icerockdev:developfrom
ExNDY:#651-test-source-set-resources
Open

ExNDY wants to merge 12 commits into
icerockdev:developfrom
ExNDY:#651-test-source-set-resources

Conversation

@ExNDY

@ExNDY ExNDY commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #895

#651 — Generate resources for test source sets

Closes #651.

Fixed

  • Attach generated Kotlin sources directly to every Kotlin Multiplatform source
    set, including shared test source sets such as commonTest and iosTest.
  • Generate resource objects for platform test source sets such as jsTest and
    iosTest when they contain their own moko-resources directory.
  • Keep test resources isolated from resources of the parallel main hierarchy
    when both are linked into the same test binary:
    • generated resource object names include the test source-set name;
    • JVM and JS string/plural bundle files include the same namespace suffix;
    • Apple test resources use their own PlatformDetailsProvider, preventing
      main-resource lookups from being redirected to the test bundle.
  • Resolve Android test resources through the namespace of the corresponding
    test component instead of the main component's R class.

Compatibility

Production resource APIs are unchanged. When a test hierarchy and its parallel
main hierarchy both contain resources, test-only resources are exposed through
a source-set-qualified object such as SharedRescommonTest. This follows the
existing naming rule for resource objects generated below the main source set
and avoids duplicate declarations and runtime resource shadowing.

Verification

  • The Kotlin 2 sample exercises test-only strings, plurals, colors, images,
    files, and assets from commonTest, plus resources declared in jsTest and
    iosTest.
  • A source set named sharedChecks, shared by the JVM and JS test
    compilations, verifies that test/main association does not rely on source-set
    naming conventions.
  • Generator tests verify isolated JVM/JS string and plural bundle names.
  • Generator tests verify that Apple strings, plurals, colors, images, fonts,
    files, and assets all reference the isolated test PlatformDetailsProvider.

@ExNDY ExNDY added this to the 0.28.0 milestone Sep 27, 2026
@ExNDY ExNDY self-assigned this Sep 27, 2026
@ExNDY ExNDY linked an issue Sep 27, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0.24.0-alpha-5: Some test resources are not added to SourceSets

1 participant