If I understand correctly, to publish a Multiplatf...
# multiplatform
c
If I understand correctly, to publish a Multiplatform library, you need to: Enable Gradle Metadata. That creates an additional publication (JAR?) that doesn't contain any artifact, but instead contains links to all variants (JVM, JS...). Publish that to jCenter, let's call it ‘core’. Now, deploy all other variants to jCenter. When someone says
api("...:...core:...")
in their Multiplatform/core scope, the Gradle plugin will understand this is not an actual dependency but rather look at the links, and add for each platform the corresponding variant (if there's one). If I understood correctly, that means I need to deploy: - the ‘core’, I guess to jCenter? - the JVM variant - the JS variant - the Linux, Windows... variants Do they all need to be deployed to the same repository for the plugin to find them? I would expect the JS variant to be deployed to NPM or something similar, and the native variants to be deployed directly to Debian's, Arch's, etc's repos...
k
I would suggest looking at community examples. You wouldn't specify "core" in the dependency. Gradle "gets it" if you have metadata. They should all be published as a unit (basically). We're mostly using Maven central now, but others use jcenter. Probably most do, but they both work well once you get past setup (non-trivial)
c
I used MavenCentral (successfully) once and understand the difficulties... I've heard jCenter was easier. That's not a requirement for me though so if you recommend Central I'll go with that
k
The repo I shared in the other thread uses Maven central and a good example of how to configure. I think you'll definitely find "easier" is a split opinion. Jetbrains uses bintray (jcenter) for most of the libraries I've seen. Libraries near, for lack of a better description, the Square universe, tend to be Maven central. I was a convert.
c
Thank you ^^
c
I'm interested in this topic, @kpgalligan could you please paste here the link to that example? Thanks a lot in advance 😄
k