ribesg
04/26/2022, 11:41 AMpublishToMavenLocal
a lot while working (for example) only on iOS and only in the simulator, so I would benefit from this kind of featureribesg
04/26/2022, 11:42 AMAnton Lakotka [JB]
04/26/2022, 12:01 PMplugins {
kotlin("multiplatform")
`maven-publish`
}
group = "test"
version = "1.0"
kotlin {
jvm()
linuxX64()
mingwX64()
}
And locally you want to publish only linuxX64
.
You can do that by calling gradle task: publishLinuxX64PublicationToMavenLocal
which will publish only linuxX64 target to your mavenLocal.
But for MPP projects its often required to publish common library as well. In order to do that you need to call: publishKotlinMultiplatformPublicationToMavenLocal
.
It is also possible to define custom maven repositories, for example, to publish it to a certain file directory.
To do so you need to declare maven repository like that:
publishing {
repositories {
maven {
name = "projectRoot"
setUrl("${rootProject.rootDir}/repo")
}
}
}
Then Kotlin Gradle Plugin will create appropriate tasks for you to publish lib to that location.
publishKotlinMultiplatformPublicationToProjectRootRepository
publishLinuxX64PublicationToProjectRootRepository
You can spot the pattern of how the tasks are named. It is: "publish" + targetName + "Publication" + "To" + repositoryName + "Repository"
ribesg
04/26/2022, 12:11 PM./gradlew publishKotlinMultiplatformPublicationToMavenLocal publishJvmPublicationToMavenLocal
and then another one because I have pure JVM modules too (non KMP). That’s very long I’ll probably add some tasks that just depend on everything you have to call depending on the platform, but at least I don’t have to iterate over all modulesmike.holler
04/26/2022, 4:06 PMribesg
04/26/2022, 4:09 PMmike.holler
04/26/2022, 4:10 PMpublishToMavenLocal
. If they are making regular changes in the dependency project and testing them locally, Gradle will handle re-compiling automatically with no need to run manual steps between changes.ribesg
04/26/2022, 4:13 PMmike.holler
04/26/2022, 4:14 PMribesg
04/26/2022, 4:19 PMmike.holler
04/26/2022, 4:36 PMephemient
04/26/2022, 5:07 PMmike.holler
04/27/2022, 1:08 AMAnton Lakotka [JB]
04/27/2022, 6:31 AMcomposite builds are unfortunately not supported for Kotlin multiplatform: https://youtrack.jetbrains.com/issue/KT-52172They are partially supported. But we want to extend this support further and making it more stable. So you are very welcome to try and share your feedback. 🙂