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

Error `Name contains illegal characters` in generated `Res.kt` while building jsTarget. #4295

Closed suhaibroomy closed 7 months ago

suhaibroomy commented 8 months ago

Describe the bug Error Name contains illegal characters in generated Res.kt while building jsTarget when the project name contains hyphen. This happens since the Plugin gets the project name and appends it to the generated files package name within ``. This works fine on androidTargets but generates an error with JsTarget

Affected platforms Select one of the platforms below:

Versions

To Reproduce

  1. Create a Compose multiplatform project
  2. Add Js target
  3. Set project name to something with hyphen
  4. Add a font (or any resource) in commonResources
  5. Run ./gradlew assemble

Expected behaviour There should be no error

luca992 commented 7 months ago

is there a way to workaround this until the next stable release is up with the merged pr?

terrakok commented 7 months ago

Yes. Just give a project name without dashes

luca992 commented 7 months ago

@terrakok a workaround that doesn't involve renaming directories/ changing module names that are already published on maven

terrakok commented 7 months ago

You are not able to publish a library with compose resources yet. Could you explain your case?

luca992 commented 7 months ago

I'm using compose resources to load files in commonTest in kamel. This in combination with #4442 is preventing me from being able to publish library builds while being able to run the tests

terrakok commented 7 months ago

https://github.com/JetBrains/compose-multiplatform/pull/4300

okushnikov commented 3 months ago

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