h0tk3y
01/16/2019, 10:32 AMh0tk3y
01/16/2019, 10:32 AM1.3.20-eap-100
published to the Maven repo <https://kotlin.bintray.com/kotlin-eap>
, here's how to apply it: https://discuss.kotlinlang.org/t/kotlin-1-3-20-early-access-preview/10748/10h0tk3y
01/16/2019, 10:33 AMkotlin {
android {
// Or android("foo") { ... }, if you use a
// custom name for this target
publishLibraryVariants("release", "debug")
}
}
If you have no product flavors in the library, then it may be just the release
variant. With product flavors, specify full variant names, like fooBarRelease
. Publishing is only supported for library variants, not application or test variants.
To publish all library variants, including the debug ones, instead call publishAllLibraryVariants()
.
If you publish several variants that share the product flavor and differ in the build type, like fooBarRelease
and fooBarDebug
, you may group them into a single publication by specifying publishLibraryVariantsGroupedByFlavor = true
(false by default), then the build types become classifiers for
the artifacts, and the release
artifact is published with no classifier.
Publishing is set up with the maven-publish
plugin, which you also need to apply. The publications are created automatically, just as for other kinds of MPP targets, but you still need to setup the repositories for publishing, or publish to the local Maven repo. More details about maven-publish
in the Gradle docs: https://docs.gradle.org/current/userguide/publishing_maven.htmlh0tk3y
01/16/2019, 10:33 AMfoo
will be replaced with a dependency on the `foo`'s JVM module, foo-jvm
.
This will work for both project-to-project dependencies and dependencies on Maven publications.
At this point, this only affects dependencies of multiplatform projects. We will likely expand this to single-platform modules in the future updates.h0tk3y
01/16/2019, 10:33 AMKotlinCompilation
now exposes allKotlinSourceSets
, which is a transitive closure of the source sets included into the compilation via the dependsOn
relation, so you don't need to collect them manually.Hauke Radtki
01/16/2019, 11:17 AMpublishing.publications.androidRelease
(e.g. for publishing to something else than mavenLocal) is only available when wrapped in an afterEvaluate
block, whereas the others are available immediately.h0tk3y
01/16/2019, 11:36 AMmavenPublication { ... }
. Note that the lambda will be called on each of the publications if there are more than one.addamsson
01/16/2019, 3:34 PMaddamsson
01/16/2019, 3:35 PMh0tk3y
01/16/2019, 3:43 PMkotlinMultiplatform
4) configure the POMs
Also please note that publishing with Gradle module metadata is not yet considered stable, and future Gradle versions may reject the published metadata. I would recommend doing that along with a stable publication, i.e. without metadata. Anyway, please experiment with a staging repository first.addamsson
01/16/2019, 3:47 PMkotlin-multiplatform
plugin.h0tk3y
01/16/2019, 3:56 PMmaven-publish
plugin, only that the kotlin-multiplatform
plugin creates the publications automatically and instead of creating them manually, you just need to do some additional configs to the existing ones, and signing configuration will differ. As for publishing to Maven Central in general, I could find this article: https://medium.com/@nmauti/sign-and-publish-on-maven-central-a-project-with-the-new-maven-publish-gradle-plugin-22a72a4bfd4b
Of course you'll need to tweak it here and there, it won't just work as-is. I'll definitely consider writing a tutorial for Kotlin MPP sometime soon.addamsson
01/16/2019, 4:02 PMkotlin-multiplatform
addamsson
01/16/2019, 4:03 PMaddamsson
01/16/2019, 4:03 PMtask sourceJar(type: Jar) {
classifier "sources"
from sourceSets.main.allJava
}
addamsson
01/16/2019, 4:03 PMallJava
IIRCaddamsson
01/16/2019, 4:04 PMkotlin-multiplatform
addamsson
01/16/2019, 4:04 PMaddamsson
01/16/2019, 4:04 PMHauke Radtki
01/16/2019, 4:05 PMh0tk3y
01/16/2019, 4:07 PMaddamsson
01/16/2019, 4:07 PMaddamsson
01/16/2019, 4:07 PMaddamsson
01/16/2019, 4:08 PMaddamsson
01/16/2019, 4:08 PMaddamsson
01/16/2019, 4:08 PMHauke Radtki
01/16/2019, 4:10 PMh0tk3y
01/16/2019, 4:11 PMaddamsson
01/16/2019, 4:24 PMaddamsson
01/16/2019, 4:25 PMaddamsson
01/16/2019, 4:25 PMaddamsson
01/16/2019, 4:54 PMkotlin-multiplatform
plugin) which makes me think that it is not ready for prime time otherwise they would have been dogfooding it I presumemsink
01/17/2019, 3:32 AMkotlin-multiplatform
.
Maybe because it is relatively simple... simple smileorangy
addamsson
01/17/2019, 9:10 AMaddamsson
01/17/2019, 9:10 AMaddamsson
01/17/2019, 9:10 AM