JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
16.15k stars 1.17k forks source link

Compose.Resources: Res package name includes parent project #4320

Closed tylerwilson closed 7 months ago

tylerwilson commented 8 months ago

Describe the bug I develop my shared code in Android Studio/IntelliJ while it is 'included' in settings.gradle.kts. I recently added compose.resources support, and when building the Res package comes out to ..generated.resources. But when I build when the library is loaded in AS, or from Xcode with the generate gradle task, the package is .generated.resources.

This then breaks any usage of the shared resources when moving between Android and iOS since the import no longer matches the current build. I would ask that the generated Res is always only relative to the shared module, and not include the parent project name.

Affected platforms Select one of the platforms below:

If the bug is Android-only, report it in the Jetpack Compose tracker

Versions

To Reproduce Steps and/or the code snippet to reproduce the behavior:

  1. Open an app project that uses a shared KMP module that also uses Compose MP resources

Expected behavior I would expect the Res to be generated the same between Android as subproject and iOS or XCFramework, etc.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context For context, here are the relevant snippets from the project files:

top level settings.gradle.kts:

include(":app")
include(":watch")
include(":salonbiz-library")
project(":salonbiz-library").projectDir = file("../salonbiz-library")

this generates Res in the following package:

package salonbiz_stylist_android.salonbiz-library.generated.resources

When building from Xcode, using the ./gradlew :embedAndSignAppleFrameworkForXcode Run Script, it generates:

packagesalonbiz-library.generated.resources

which then no longer matches the. import where the resources are used.

dima-avdeev-jb commented 8 months ago

Thanks for this Issue! We will take a look

terrakok commented 7 months ago

To make it predicatable and stable you are suppose to specify a goup name in the module build config:

group = "my.module.with.resources"
okushnikov commented 2 months ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.