Hello everyone, I am trying to setup a mpp project...
# multiplatform
p
Hello everyone, I am trying to setup a mpp project with multi-module setup. First question, is it yet possible for iOS app to depend on multiple mpp modules? I have this kind of dependency tree,
androidApp (Android app)
↓ impl
repository (mpp lib)
___________ | api ↓impl | ____`network (mpp lib)` ↓ ↓impl
data (mpp lib)
with the regular config from the mpp hands on, I am getting this error when I run
packForXcode
Copy code
> Task :network:linkDebugFrameworkIos FAILED
e: .../network/build/classes/kotlin/ios/main/network is cached (in ~/.konan/kotlin-native-macos-1.3.71/klib/cache/ios_x64-gSTATIC/libnetwork-cache.a), but its dependency isn't: .../data/build/classes/kotlin/ios/main/data
e: org.jetbrains.kotlin.backend.konan.KonanCompilationException:
k
yes, it's possible, though I believe not with cocoapods
p
what is the alternative? @Kris Wong For now I ended up publishing dependencies to maven local which seem to have solved the above issue but still some hurdles
k
umbrella framework is the alternative
👍 1
k
Is this using multiple frameworks from separate kotlin libs? We had a post on that https://twitter.com/TouchlabHQ/status/1251241674342162434?s=20
👍 1
We also have a fork of the cocoapods plugin to allow doing some of these things, but that dev is ongoing. However, in general, multiple frameworks will be difficult unless they really don’t need to talk to each other
k
yeah, in my case my frameworks are all independent
but I can confirm that that works well 🙂
k
Next up is estimating what that does to binary sizes
k
static is the way. but you definitely end up with duplicated symbols from the stdlib and any other common dependencies
k
I think it’ll work great for situations like SDK vendors, or if things are really separate, but understanding the situation is important. The multiple frameworks question is usually in the form of a binary (as in “can you or can you not?“), but it’s a little more complicated
k
i would be interested to see an analysis of that
k
Are you using static for multiple frameworks? The info we got was that will work in release mode, but not debug, but will be fixed in 1.4, but reading through the linked discussions I want to reconfirm the “debug vs release” nature of that: https://github.com/JetBrains/kotlin-native/issues/2423#issuecomment-591504566
Look for “Does this include static frameworks?” here: https://dev.to/touchlab/multiple-kotlin-frameworks-in-an-application-34e9
k
yes, we a re using multiple static frameworks, but we only build release
I pass
listOf(RELEASE)
to the framework method in the build script
k
Hmm. OK.
k
i haven't tried it with debug
k
I didn’t do the research, so when the results are weird I’m always like “how many times did you check that…”
I guess I have trust issues
k
🙂
this GH issue also mentions cocoapods, which we are also not using
k
Once we dug into the cocoapods, the real issue with the Kotlin cocoapods plugin is you can’t configure it like you can if you just write your own. We’re trying to extend it so you can configure it more
Static vs dynamic, for example
p
Thanks guys, lot of good resources, that is what exactly I am trying to achieve and looks like umbrella framework is the answer, I will dig into it 👍
that doesn't cover publishing. but it's possible to use maven. I have that as a separate post.