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

Robert Jaros

03/06/2020, 2:44 PM
Can I have more than one common artifacts build from one MPP project?
k

Kris Wong

03/06/2020, 3:38 PM
what do you mean by common artifact?
r

Robert Jaros

03/06/2020, 4:34 PM
jar artifact published on maven/bintray, containing metadata from common sources
k

Kris Wong

03/06/2020, 4:37 PM
so you want multiple JVM targets?
r

Robert Jaros

03/06/2020, 4:38 PM
multiple js + multiple jvm targets
i'm using currently old mpp project structure with gradle subprojects
I'm trying to migrate to new mpp with multiple sourcesets
k

Kris Wong

03/06/2020, 4:40 PM
yes, you can do that
r

Robert Jaros

03/06/2020, 4:42 PM
any example how to do this?
k

Kris Wong

03/06/2020, 5:03 PM
jvm("target-1") jvm("target-2")
r

Robert Jaros

03/06/2020, 5:08 PM
i have something like this, but it doesn't create common artifacts
jvm artifacts (and js too) are created ok
but I don't know how can i configure commons
only one
*-metadata-*.jar
is build and it's empty
k

Kris Wong

03/06/2020, 5:15 PM
i'm still not sure what you mean by common artifacts. are you referring to the artifact for gradle metadata?
n

Nick Halase

03/06/2020, 5:16 PM
@Robert Jaros are you referring to "building universal frameworks" from this document? https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#publishing-a-multiplatform-library
r

Robert Jaros

03/06/2020, 5:19 PM
no, I'm not using K/N
I don't know if I understand this correctly, but perhaps I don't need common artifacts at all if I use experimental gradle metadata publishing mode?
k

Kris Wong

03/06/2020, 5:26 PM
let me ask this - what do you expect to be included in a "common" artifact?
r

Robert Jaros

03/06/2020, 5:29 PM
currently it contains some *.kotlin_metadata files
I've got these three artifacts now
But I'm not really sure what are they used for ;-)
k

Kris Wong

03/06/2020, 5:32 PM
those are not necessary, unless you have some specific reason for them
you will typically have 1 artifact per target (or maybe one per build variant), along with 2 artifacts for gradle metadata
r

Robert Jaros

03/06/2020, 5:36 PM
ok, thx - I'll just try to ignore this and continue the migration - soon I'll be able to test app compilation so I'll know if it works
2 Views