Is there a way to publish a multiplatform library ...
# amper
j
Is there a way to publish a multiplatform library using amper?
a
Hi! Thanks for the question! After you setup an Amper library by
Copy code
product:
  type: lib
  platforms: [...]
You already have gradle tasks for publication You will probably want to set up repositories, credentials, you could do it using gradle interop: Just create
build.gradle.kts
alongside with
module.yaml
and you could write anything you want, so to define repositories, you could do something like this
Copy code
publishing {
    repositories {
        maven {
            // change to point to your repo, e.g. <http://my.org/repo> and setup credentials if you want
            url = uri(layout.buildDirectory.dir("repo"))
        }
    }
}
The only issue left, is android publication, because it requires to enable publication of variants you want to publish separately, and since, Amper creates
androidTarget
for you, you don't need to create this target once again, but to configure existing one: something like this:
Copy code
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget

kotlin {
    targets
        .filterIsInstance<KotlinAndroidTarget>()
        .forEach { it.publishLibraryVariants("release") }
}
Hope it helps, if you have follow up questions, don't hesitate to ask!
🚀 1