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

Hadi Lashkari

09/07/2020, 9:33 AM
Hi everyone! To enable the hierarchy structure support, I set
kotlin.mpp.enableGranularSourceSetsMetadata=true
in
gradle.properties
as you can find in https://kotlinlang.org/docs/reference/mpp-share-on-platforms.html#share-code-on-similar-platforms, but as a side effect, android source set is not included in the publication! How can I publish for android then? My project is https://github.com/hadilq/log4k/ if it helps. Thanks
😨 1
h

Hadi Lashkari

09/07/2020, 10:08 AM
Thanks @audriusk! I have read that, but I cannot see anything related to
kotlin.mpp.enableGranularSourceSetsMetadata
! if you mean using
publishLibraryVariants("release", "debug")
I used it before and I switched to
publishAllLibraryVariants()
and it was working! After I add
kotlin.mpp.enableGranularSourceSetsMetadata
it's not publishing for android anymore! Any idea?
🤷‍♂️ 1
l

louiscad

09/08/2020, 11:39 AM
@russhwolf I think it's working okay for multiplatform-settings, right?
r

russhwolf

09/08/2020, 2:23 PM
Yeah I think so. There's some chance I deployed the last version before adding that line. I have had trouble with
kotlin.native.enableDependencyPropagation=false
on that project which I keep meaning to go back and build a minimal sample for
h

Hadi Lashkari

09/08/2020, 2:28 PM
Thanks guy for following up. What is multiplatform-settings? So how can I fix it?
r

russhwolf

09/08/2020, 2:29 PM
Two guesses: 1. Try applying Android plugin before Kotlin (ie reverse these two lines https://github.com/hadilq/log4k/blob/main/log4k/build.gradle.kts#L19-L20) 2, Try removing this block https://github.com/hadilq/log4k/blob/main/log4k/build.gradle.kts#L176-L178. I've never disabled metadata but it seems like it might do bad things to the MPP publishing process
h

Hadi Lashkari

09/08/2020, 2:43 PM
Thanks Russell, I'll check and come back 🙂
Thank you Russell! The first suggestion, solved the problem! For the second one, I've disable metadata to avoid
No matching variant of com.github.hadilq:log4k-metadata:2.3.1-SNAPSHOT:20200908.145840-4 was found.
! Problem! And removing it still make that problem whenever I add implementation(log4k) in
gradle.build.kts
file of another multiplatform module!
l

louiscad

09/08/2020, 4:17 PM
So @Hadi Lashkari you have the plugins applies in the right order, and you stopped disabling Gradle metadata, and now, everything works properly, right?
h

Hadi Lashkari

09/08/2020, 5:50 PM
@louiscad I just reordered the plugins and everything works properly as you can see in its commit https://github.com/hadilq/log4k/commit/2026aaa0f582e300bcaf3fc13ee7e333270924e4 Thanks for following up!
Hey guys! I tried to publish a release but noticed that the jar file(https://oss.sonatype.org/content/repositories/snapshots/com/github/hadilq/log4k-android/2.3.1-SNAPSHOT/log4k-android-2.3.1-20200908.195517-6-sources.jar) is not including
jvmMain
and
androidMain
directories, just
commonMain
! I have to say it had all these three directories before above commit! For instance, https://oss.sonatype.org/content/repositories/snapshots/com/github/hadilq/log4k-android/2.3.1-SNAPSHOT/log4k-android-2.3.1-20200907.155234-1-sources.jar Any idea?
r

russhwolf

09/08/2020, 8:33 PM
No idea but I'd recommend re-enabling metadata and see if that helps
h

Hadi Lashkari

09/09/2020, 7:26 AM
Thanks Russell! I did re-enable it, but it didn't help! So probably it's a plugin bug!