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
15.27k stars 1.11k forks source link

Material 3 depends on some Material 2 modules #4908

Closed ellet0 closed 1 week ago

ellet0 commented 1 month ago

This is not a bug but will cause other unrelated bugs to other issues

The Material 3 module depends on some Material 2 modules like material-icons-core and material-ripple, refer to Compose Multiplatform Core GitHub repository, in material3/material3/build.gradle#L104

api(project(":compose:material:material-icons-core"))
api(project(":compose:material:material-ripple"))

While this may sound like not an issue as it depends on the individual perspective, it could cause other issues that are not directly related to this

Like on Compose Desktop

The desktop release version that is created by the Compose desktop Gradle plugin will Proguard, and currently with the current default Proguard rules, it seems there is an issue when using Material 3 in the release version (with Proguard), I managed to get it working with a workaround and I have to not exclude Material 2 from Material 3 in the comment mentioned above, take a look at the issue #4883 or other related issues and you will notice it's quite related to this feature request

A solution would be to have a separate Gradle module like material-shared and extract the shared code between Material 2 and 3 to use it in this module, this can be achieved without a breaking change, which could help fixing #4883 and #497 but other specific changes is needed to fix them and related issues

MatkovIvan commented 1 week ago

It should be reported to Google issue tracker. It's not the change introduced by this fork and we're not going to change module structure without Google's AOSP repo.

ellet0 commented 1 week ago

It should be reported to Google issue tracker. It's not the change introduced by this fork and we're not going to change module structure without Google's AOSP repo.

I see, regarding using Material 3 without 2 or something else like Cupertino.

The module compose.desktop.currentOs doesn't seem to be from Google, it require Material 2 unless it explicitly excludes it. On Google Android, you can either use Material 2, 3, or both.

Which is not the same module structure as Google.

MatkovIvan commented 1 week ago

compose.desktop.currentOs is different thing, yes. And it's tracked in #497

But in this issue description you wrote not about this gradle plugin getter, but about material-icons-core and material-ripple. And it's from AOSP