Hello is there any example repository of having mu...
# multiplatform
d
Hello is there any example repository of having multiple feature modules as described in https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-project-configuration.html#several-shared-modules ?
i
Maybe I don't understand your question but in a setup like the typical examples, you can just add more modules like
shared
that implement whatever features you need and have
shared
depend on those modules via
implementation(projects.myOtherModule)
or
implementation(project(":myOtherModule"))
if you aren't using the project accessors feature https://github.com/android/kotlin-multiplatform-samples/tree/main/Fruitties
👍 1
d
Thanks
must these modules also be kotlin multiplatform modules?
i
Just like any other dependencies, you can use language specific targets just fine such as using junit in jvm testing.
👍 1
d
And since you know this stuff: Is there a difference between multiple top level modules vs nested modules, other than folder structure?
i
what do you mean by top level?
d
Root folder
i
If you're asking purely in the sense of placement in the folders, no it doesn't matter. Projects can be structured any way you like. Our big project looks like this..
Copy code
root
  /composite
     /custom-plugin-a
     /custom-plugin-b
     /custom-plugin-c
  /android-common
     /module-a
     /module-b
     /module-c
  /kmp-common
     /module-a
     /module-b
     /module-c
  /smart-tv
     /common
     /brand-a
     /brand-b
     /brand-c
  /android-tv
I'd recommend coming up with an organization hierarchy that makes sense for you/your team but it can be generally anything you like. Note we use composite builds to go even further where we have built custom plugins that are completely isolated gradle projects. This helps with caching over using
buildSrc
and enables us to open them as isolated projects in intellj without loading the greater project which can make it a lot faster to test plugin changes.
d
Alright, thanks. I'm gonna stick to modules for now.