https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
c

Colton Idle

06/05/2021, 4:21 AM
Not sure if this is a better question for #multiplatform or for #compose-desktop but I'll ask here first. I basically have an android project with an app module. Really simple. Then I added a
composables
module. Android only. This left my composables module with a build.gradle with a top level
dependencies{}
block. I now converted it to multiplatform for compose desktop and so I have dependencies declared in a
kotlin {}
block. i.e.
Copy code
kotlin {
    android()
    jvm("desktop")

    sourceSets {
        named("commonMain") {
            dependencies {
                api(compose.runtime)
                api(compose.foundation)
                api(compose.material)
            }
        }
    }
}
My question (sorry for being a complete kmm noob) is that is there any reason why I would keep a top level dependencies{} block around? I still have dependencies defined there, but if I remove it then everything seems fine. When using kmm is the gist that we never use top level dependencies block?
r

rnett

06/05/2021, 4:57 AM
I'm surprised your buildscript compiles, tbh (at least if it's
.kts
), there is no top level dependencies block for multiplatform
c

Colton Idle

06/05/2021, 5:06 AM
Really? Here's my entire build file kts ^^^^ So I'm basically trying to simplify that entire file but I don't know what I should delete as everything actually works at the moment.
r

rnett

06/05/2021, 5:32 AM
See https://kotlinlang.org/docs/mobile/discover-kmm-project.html#android-library, all the deps are in the android source set. The only reason you have a top level dependencies block is the android plugin, I think.
c

Colton Idle

06/05/2021, 2:10 PM
Thanks @rnett sounds like that dependency block I have can go away safely. Thanks!