https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
b

Big Chungus

06/19/2021, 1:39 PM
is it possible to publish MPP artefact with no sources? My use-case is a "marker" artefact that declares dependencies on all library modules to make it easy to get them all via transitive dependencies.
r

russhwolf

06/19/2021, 1:49 PM
I think the Kotlin Native compiler gets mad if there's nothing in any source dirs but you can get away with a single empty file
b

Big Chungus

06/19/2021, 1:50 PM
That's what I'm doing at the moment, however that still results with a class being generated for JVM
l

louiscad

06/19/2021, 2:46 PM
You can put it in nativeMain or alike instead of commonMain
b

Big Chungus

06/19/2021, 3:04 PM
but then jvm kotlin jvm compiler complains
The only thing I'm interested in from that artefact is gradle module file and pom.xml
l

louiscad

06/19/2021, 7:23 PM
It's weird, I have no issues making artifacts grouping dependencies in Splitties, and I'm using the KMP Gradle plugin
b

Big Chungus

06/19/2021, 7:23 PM
Are they with empty sourceSets?
l

louiscad

06/19/2021, 7:24 PM
Yes
No code. Published to a maven repo
b

Big Chungus

06/19/2021, 7:25 PM
Hmm, something might've changed then. Last I tried it was on kotlin 1.3 tbh. Let me give it a go with 1.5.30 :D
No dice, klib is not being generated if there are no sources
Copy code
> java.io.FileNotFoundException: \\wsl$\Ubuntu\home\mpetuska\IdeaProjects\template-kmp-library\build\classes\kotlin\androidNativeArm32\main\klib\template-kmp-library.klib (No such file or directory)
l

louiscad

06/19/2021, 7:32 PM
Fails only on native it seems
Worth a kotl.in/issue report IMO, because this is a use case that you'll not be the only one to encounter
b

Big Chungus

06/19/2021, 7:33 PM
Do you have any native targets in your project?
l

louiscad

06/19/2021, 7:34 PM
Yep, but the grouping artifacts currently target Android only, so that's most likely why I don't encounter the issue.
b

Big Chungus

06/19/2021, 7:35 PM
Seems to be native specific, then
l

louiscad

06/19/2021, 7:35 PM
I think the Kotlin/Native part rests on wrong assumptions, so an issue report would be helpful to have these removed.
I think you'll not get the issue if you publish the grouping for JVM only, or Android only. I don't know for JS(IR) and JS legacy.
b

Big Chungus

06/19/2021, 7:41 PM
https://youtrack.jetbrains.com/issue/KT-47345 Although this behaviour seems to have been implemented intentionally.
7 Views