Are there any KMM sample projects that have a nest...
# multiplatform
t
Are there any KMM sample projects that have a nested multi module library architecture like so: • Repository (KMM Library) ◦ Local (KMM Library) ◦ Remote (KMM Library) where each KMM module/library can be published as a maven repository while also making development comparatively easy (in terms of switching between published maven artefact and sourcecode during development)
b
Use gradle composite builds
m
It is just multi-module set-up right? Nesting is just about one module depending on the other. While modules can be published separately, right? Just making sure I understand.
t
Thanks, i will take a look at composite builds! Yes you are right, it is just a multi module setup where modules depend on others. In my example above, the Repository depends on Local and Remote. What i want is the following: • I want Clients (e.g. Android and iOS Apps) to be able to include the Repository Library (that encapsulates Local and Remote) via maven. • I want Clients to be able to include Local or Remote directly via maven. (skipping the Repository Library) • I want a development setup that is comparatively easy (e.g. no extra deployments or library publishings while editing multiple modules in parallel) I thought of something like referencing the modules directly from source during development and switching to maven on the build system?
b
If all your modules are in the same repo you can reference them directly and should not use composite builds.
☝️ 2
e.g.
Copy code
dependencies {
  implementation(project(":my-other-module"))
}
Gradle will handle artefact coordinate injection when publishing
t
Yes, this is what i want for local development. However, when publishing the Repository Library with the following dependencies in place
Copy code
implementation(project(":local"))
implementation(project(":remote"))
The Local and Remote modules won’t be available within the published Repository Library. I assume that i first need to publish Local and Remote and within the Repository include these Libraries via maven, right?
m
You can have modules depending on each other and publish them as well. This is actually not KMP specific problem - more a gradle / maven publish one 🙂 We do this in Android project right now, demo app is depending on library for development, and library is published to maven repo as well. You just need to make sure that publish plugin is correctly set up for all modules that you want to publish.
☝️ 1
k
Are you planning on supporting iOS devs with something other than maven? Cocoapods/SPM? That's what we've been setting up with teams, so you can pull and run latest without needing to build the framework from Kotlin.
t
thanks for your answers! Yes we are planning on supporting iOS devs with resources apart from maven. But we are currently analyzing and testing what setup suits best for our team