Question, how come `import androidx.compose.founda...
# compose-desktop
u
Question, how come
import androidx.compose.foundation
ui
etc work in compose desktop? In my android project I tried to use those dependencies in a pure
kotlin
(jvm) module (just some extensions, no @Composable stuff), and gradle complained about the module not applying `kotlin-android`so I figured those have an android dependency? Or did I mess something up?
a
Compose for Desktop has its own artifacts that can be used in pure JVM modules.
u
but how? when I click into say
MaterialTheme
class, its exactly the same is it just a copy? they take all of the android compose sources, and strip the android stuff, and publish?
a
Basically that, and delegate to Google version for Android.
u
Tldr; if it were interfaces then I'd get it, they just provide desktop impl, but its whole concrete sources, so it must be a copy
okay understood, thanks!
which kind of makes me wonder why, must be very error prone process to update -- how come the android bits are not isolated, so just a different impl would be provided, so no need to copy stuff? must be bit more nuisanced
a
Sounds like you need to learn some basics of Kotlin multiplatform.
u
that might be true, but looking at the dependency graph I'd expect there to be some androidx dependency, where the jetbrain dependecy provides the `actual`s but yea, I never actually built stuff with kmm
e
if you apply the org.jetbrains.compose gradle plugin, it'll give you a shortcut for the proper dependencies (e.g.
dependencies { implementation(compose.foundation) }
), substituting them as appropriate for Android
in general you should always use the plugin when working with compose multiplatform, https://github.com/JetBrains/compose-jb/issues/1404
u
Yes but my question now is, say
MaterialTheme.kt
, is in both the jetbrains and in androidx package, is it 1) pulled in via som dependency (not visible in the graph 2) or is it a "copy paste"