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

yshrsmz

04/01/2020, 8:00 AM
Hi, I've encountered a weird error while upgrading my KMP library to Kotlin 1.3.71. My lib consists of two modules, one is core KMP lib, and the other is a Gradle plugin. When I try to execute test cases for the Gradle plugin, one of these throws an error like
Copy code
e: Could not find "kotlinx-serialization-runtime" in [/Users/yshrsmz/repos/github.com/yshrsmz/kgql, /Users/yshrsmz/.konan/klib, /Users/a12897/.konan/kotlin-native-macos-1.3.71/klib/common, /Users/yshrsmz/.konan/kotlin-native-macos-1.3.71/klib/platform/ios_x64].
Here's the repo https://github.com/yshrsmz/kgql/tree/kotlin1.3.71-builderror If you run
$ ./gradlew build
at the root directory,
The generate task is a dependency of multiplatform ios target - X64
test fails. https://github.com/yshrsmz/kgql/blob/kotlin1.3.71-builderror/kgql-gradle-plugin/src/test/kotlin/com/codingfeline/kgql/gradle/KgqlPluginTest.kt#L166-L181 The weirdest part is, this test some time passes. It fails almost all the time, but sometimes it succeeds.
i

ilya.matveev

04/01/2020, 12:11 PM
Hi! Your problem relates to compler caches. I'm still digging into it but as a workaround you may disable them. Here is the patch:
y

yshrsmz

04/03/2020, 9:31 AM
@orangy Thanks! this seems to solve the problem for now(actually I'm not sure if this is really
fixed
or it is fortunately succeeding several times in row)
i

ilya.matveev

04/09/2020, 7:59 AM
@yshrsmz I have an update regarding your problem. The test failure is caused by dependencies of
kgql-core
. For some reason dependencies added to the
nativeMain
source set were not written to metadata for the published
kgql-core
artifact. So the cache builder cannot compile caches due to the missing dependencies. This behaviour is observed only when the
nativeMain
source set is added to compilations using the
source
method. If you specify a
dependsOn
relation between platform source sets and
nativeMain
instead of using the
source
method, the dependencies become correct and the cache builder works fine. Please note that using the
dependsOn
relation is the recommended way to configure a source set hierarchy. So, the patch attached should fix your problem. After that you may enable the caching back.
y

yshrsmz

04/09/2020, 1:19 PM
@orangy Thank you so much! I can confirm that
kotlinx-serialization-runtime-native
does not exist in dependencies when I use
source
, and exists when I use
dependsOn
. Out of curiosity, is this something that will be fixed?
i

ilya.matveev

04/09/2020, 1:25 PM
Yes, it should be fixed. We don't know the exact root cause yet, so I'm going minimize this sample and investigate this problem deeper. But probably not in the near future. BTW,
@orangy
is another guy, let's not disturb him 🙂 My nickname is @ilya.matveev.
y

yshrsmz

04/09/2020, 1:26 PM
woops, sorry
2 Views