Hi All, before I give this a try, does anyone know...
# multiplatform
n
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
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
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
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
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
I just merged it, there should be snapshots available in ~30min: https://github.com/apollographql/apollo-android#snapshots
n
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
Thanks for trying it 🤗
I'll make a release on Monday
n
The snapshot works too. Thanks so much for the help, I really didn't know what was going on there.
👍 1