Is your feature request related to a problem? Please describe.
We are playing with Kotlin Multiplatform projects at the moment and publishing our artifacts via JitPack. But JitPack builds only on Linux so we can't build some Native targets (e.g. iOS), as it requires macos host. Taking into account that Github Package Registry is coming, I think it would be nice to add macos host to JitPack.
Describe the solution you'd like
Add ability to publish Kotlin Multiplatform libraries with Native targets
Describe alternatives you've considered
Manual publishing to JCenter, signed up for Github Package Registry beta
Additional context
Travis can be configured to build on multiple hosts, perhaps same technique could be used
Hi,
That's an interesting suggestion, thank you!
Would it be enough to build your whole project on macos or do you require some parts built on Linux?
At the moment we are targeting JVM, iOS and Linux so Macos would work for us as it can build all our targets. But other people might be interested in Windows and it requires Windows host.
So first iteration might be to just allow selection between Linux and Macos (we would just select Macos).
Second iteration might be to allow partial selection.
I'll second this. We're investing heavily in Kotlin multi-platform libraries that are published for use on Android and the JVM, but we'll be publishing them for iOS soon, too.
Hi,
We've added preliminary support for Kotlin MPP libraries. In particular we now handle Gradle metadata (.module) in our Linux builds.
Hi @jitpack-io,
Do you have a sample build.gradle for this Kotlin MPP support? I couldn't find any in your existing repositories.
Thanks!
@yslvlln Here are some KMP projects:
https://github.com/badoo/Reaktive - this one uses regular Groovy Gradle scripts
https://github.com/arkivanov/MVIKotlin - this one uses Kotlin Gradle scripts
Hope this helps
Will look into this. Thanks a lot @arkivanov!
@yslvlln Recently KMP evolved a bit so might be worth another look. Setting this up got a lot easier. Basically the multiplatform plugin has out of the box support for publish. There have been a few changes to the meta data part and how gradle handles this. E.g. It is able to figure out for a js project to depend on the -js variant.
I have a simple project that I'm trying to publish via jitpack currently. Currently it half works in the sense that I can publish but not depend on the dependencies.
The project is: https://github.com/jillesvangurp/geogeometry & https://jitpack.io/#jillesvangurp/geogeometry
Release 3.1.4 for this was a kotlin multi platform build. See logs + build file in this gist: https://gist.github.com/jillesvangurp/8b1d8bcfa930a0f1a419a11f33462c74
This initially looks like it works. But when I try to depend on the -jvm jar in a different project, I get a 401 from jitpack:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileKotlin'.
> Could not resolve all files for configuration ':compileClasspath'.
> Could not resolve com.github.jillesvangurp:geogeometry-jvm:v3.1.4.
Required by:
project :
> Could not resolve com.github.jillesvangurp:geogeometry-jvm:v3.1.4.
> Could not get resource 'https://jitpack.io/com/github/jillesvangurp/geogeometry-jvm/v3.1.4/geogeometry-jvm-v3.1.4.pom'.
> Could not GET 'https://jitpack.io/com/github/jillesvangurp/geogeometry-jvm/v3.1.4/geogeometry-jvm-v3.1.4.pom'. Received status code 401 from server: Unauthorized
I've also tried depending both:
implementation("com.github.jillesvangurp:geogeometry-jvm:v3.1.4")
or
implementation("com.github.jillesvangurp:geogeometry:v3.1.4")
For a different project I use a google storage bucket as a poor man's gradle repository and there it works as it should. So, I know my build file is OK. To me it looks like either files are missing/not uploaded or access to those files is somehow not allowed. Since it seems to be close to working; it might be worth getting this over the finishing line.
KMP is about to be more important now that Kotlin 1.4 is out so fixing this would be really nice. I have several libraries that are probably going to be multi-platform soon.
Note, for the project above I have now switched to rsyncing a local file repository to my website. This seems to work fine. So the issue is definitely with how jitpack handles the generated artifacts as the exact same artifacts when uploaded unmodified to a website seem to work fine.
Hello, is there any news on this? It would be super nice to be able to use Jitpack with KMM projects reliably, especially now that they've officially reached alpha (and hopefully won't make significant changes over time).
Hey @jitpack-io, any updates 1.5 years after the creation of this issue? 馃檪
Would really love to see this @jitpack-io
Since Jcenter and Bintray are shutting down, it would be really cool to have Jitpack working with Kotlin Multiplatform!
@arkivanov
It's almost available for Kotlin Multiplatform.
For a multi-module project, the artifacts are published under com.github.USER.REPO:MODULE:VERSION now.
And version id is provided through project property.
Let's take https://github.com/ArcticLampyrid/KtJsonRpcPeer as an example
You can find the following in log
Running: ./gradlew clean -Pgroup=com.github.ArcticLampyrid -Pversion=master-9459df002c-1 build publishToMavenLocal
We can see that group is wrong (it's in a format for single-module project, but KPP is always a multi module project) but version is correct.
Then let's overwrite group in build script but keep version as it is.
group = "com.github.ArcticLampyrid.KtJsonRpcPeer"
if (version.toString() == "unspecified") {
version = "0.7.0" // set if version is not provided (impossible for JitPack)
}
Finally kotlin should generate the correct metadata.
Most helpful comment
Since Jcenter and Bintray are shutting down, it would be really cool to have Jitpack working with Kotlin Multiplatform!