Is there a way to share a Multiplatform library wi...
# multiplatform
m
Is there a way to share a Multiplatform library without publishing? I'm looking at the docs, and I only see a way to do it by publishing to a local maven repo, which requires versioning and seperate builds. I would really like to have a single gradle project with multiple sub-projects, and depend on the libraries using direct/non-artifact semantics. I've played with having the top-level application project use either
id("org.jetbrains.kotlin.jvm") version "2.2.0"
or
id("org.jetbrains.kotlin.multiplatform") version "2.2.0"
, but I can't get a build in either situation. I am getting a gradle error and will continue to debug (not hard blocked), but I'm wondering if this is a supported use-case and if there is documentation available for handling it.
h
Sure. Use a includedBuild
👍 1
m
I'm unfamiliar, and searching. If it's trivial for you, could you link documentation or an example of
includedBuild
, either on a Multiplatform project or otherwise?
Everything I'm seeing about
includeBuild
(which might be different, but they seem to be related), assumes different projects. The goal is to keep these as single-project.
d
@Marshall Mann-Wood you can reference one subproject from the other using
project
dependencies. I highly recommend you to read about Gradle, because it seems to me this is a Gradle question. Also, you should look at how other projects are set up. There are many open-source projects on GitHub that are Kotlin Multiplatform and use subprojects.
h
Oh, if you just want a multi project build because you want to use a mono repo without Gradle includedBuilds, yeah just use a sub project. There is no real difference if you consume a published library or a sub project. That stuff is handled by Gradle. All you need to do is changing the coordinates from a groupartifactversion to the sub project. IncludedBuilds are mostly used for multi repos, especially if you want to change a dependency with a local build.
b
You could publish to GitHub packages