Context: I'm developing a Kotlin MP API (or SDK) targeted for Android/iOS. The project includes the common code (MP) and probably some platform-specific code (Android/iOS). It doesn't include client apps, as the consumers would import the generated native libraries from outside this project.
Based on this, would you have only one build.gradle file (with the appropriate targets/sourceSets) or would you rather have many: for instance, one main in the parent project and others for "child" modules (Android, iOS and possibly 'common')? For now I have only one at project (root) level.
Thanks in advance.
k
Kris Wong
11/05/2019, 2:30 PM
I use one build.gradle.kts for each library/framework
s
Sylvain Patenaude
11/05/2019, 2:47 PM
So in my case of Android/iOS targets, you mean one per target?
So I would have 2? But none at root/project level that contains multiplatform stuff?
Such as:
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.3.50'
}
k
Kris Wong
11/05/2019, 2:55 PM
sorry, my statement was ambiguous
one per project (module)
s
Sylvain Patenaude
11/05/2019, 3:12 PM
Ok. So you have one at root level as well (parent project/module).
k
Kris Wong
11/05/2019, 3:13 PM
just one
try the "Mobile Shared Library" project template in IDEA and you will see the setup
s
Sylvain Patenaude
11/05/2019, 3:16 PM
Yeah, that's what I did. There's only a single build.gradle file in that setup (in the root folder of the project). In all the sub-modules (commonMain, iosMain, jvmMain, etc.), there aren't any build.gradle file.