https://kotlinlang.org logo
n

Neal Sanche

02/16/2021, 10:00 PM
Hi All, before I give this a try, does anyone know if a KMM module can have a dependency on another KMM module in the same project? I've come up against a set of plugins that seem to be incompatible with each other (moko-network, apollo graphql) and was thinking that if I could split the moko-network dependency into a separate module, that might solve my issues. Any idea?
m

mbonnin

02/17/2021, 12:41 AM
Hi 👋. Apollo maintainer here. Multiplatform modules can definitely depend on other multiplatform modules but we might be able to fix the incompatibility itself. How does the incompatibility manifest itself?
n

Neal Sanche

02/17/2021, 4:01 PM
I have made a small github repository that demonstrates. Gradle sync fails on it. The addition of the one line (and no configuration is required, but it does the same thing regardless). https://github.com/nealsanche/MokoNetworkTest/blob/main/shared/build.gradle.kts#L8
🙏 1
I have split the Moko-network code generation into a separate MPP module and it works for what I need right now. It'd be nice to not have to worry about it though, so maybe there's a fix that can be made. Let me know if I can be of any assistance in that task.
@mbonnin The error that occurs looks like this:
Copy code
A problem occurred configuring project ':shared'.
> Failed to notify project evaluation listener.
   > Cannot change dependencies of dependency configuration ':shared:androidDebugApi' after it has been included in dependency resolution.
   > Cannot change dependencies of dependency configuration ':shared:iosArm64Api' after it has been included in dependency resolution.
   > Cannot change dependencies of dependency configuration ':shared:iosArm64TestApi' after it has been included in dependency resolution.
   > Cannot change attributes of dependency configuration ':shared:iosArm64ApiElements' after it has been resolved
   > Cannot change dependencies of dependency configuration ':shared:iosX64Api' after it has been included in dependency resolution.
   > Cannot change dependencies of dependency configuration ':shared:iosX64TestApi' after it has been included in dependency resolution.
   > Cannot change attributes of dependency configuration ':shared:iosX64ApiElements' after it has been resolved
I assume that both plugins are adding dependencies. Maybe there's an issue with that process? Maybe there's a different way to do it that won't conflict? I really don't know.
m

mbonnin

02/17/2021, 5:47 PM
Thanks! I don't think Apollo Android is adding dependencies but it does resolve some so maybe moko comes after that, I'll take a loo
Ultimately, I'm not sure how different plugins are supposed to "react" to different lifecyle events such as dependencies resolutions
Since this is a sanity check and not required for codegen, I'll add a flag to disable it
👍 1
Actually, I found a way to make it work without disabling the sanity check: https://github.com/apollographql/apollo-android/pull/2935
If we can keep the sanity check that's even better
n

Neal Sanche

02/18/2021, 9:33 PM
Interesting. I might have to see if I can pull your branch and make it work. I've run into another issue that makes having multiple MPP modules breaking ios unit tests. Alpha ecosystems are fun.
m

mbonnin

02/18/2021, 11:11 PM
I just merged it, there should be snapshots available in ~30min: https://github.com/apollographql/apollo-android#snapshots
n

Neal Sanche

02/19/2021, 3:26 AM
I compiled it myself, and tried it. I think the fix you have put together does work. I'll try the snapshot as well. Thanks for merging it!
m

mbonnin

02/19/2021, 9:47 AM
Thanks for trying it 🤗
I'll make a release on Monday
n

Neal Sanche

02/20/2021, 3:32 AM
The snapshot works too. Thanks so much for the help, I really didn't know what was going on there.
👍 1
4 Views