Big Chungus

04/12/2021, 10:40 AM
I hope anyone from JB is here, as I've got a question. Are there any plans on supporting metadata-only libraries? The idea is to publish only commonMain output without any kotlin targets declared and being able to use it in any consumer project with arbitrary target set. Such artifact could only depend on other metadata-only libraries. EDIT: It'd be ideal to also allow dependencies on libraries with expect-actual for ALL kotlin targets (meaning metadata artifact from such dependencies covers all bases too, although I understand that this would be much harder to maintain) If not, it'd be nice to have an "exhaustive" gradle dsl target shortcut that registers all targets for the lib project.


04/12/2021, 12:04 PM
I think that the last one is planned, about only metadata I know nothing

Sebastian Sellmair [JB]

04/12/2021, 12:19 PM
We are pretty aware of your proposed use case, but there are many non trivial things to consider here, which makes it hard to share anything right now!

Big Chungus

04/12/2021, 12:22 PM
Understandable, thanks for the clarification.


04/12/2021, 12:38 PM
For a shortcut, you can do something like
Copy code
kotlin {
  presets.forEach { targetFromPreset(it) }
but it's a little more complicated because you can't have both Android and JvmWithJava, and you need to select which JS target to build (legacy, ir, or both)
Messing around with that may start to give you a sense of why it's not so easy for JB to provide an API for this without some deeper consideration
👍 1