Is it possible to export transitive dependencies t...
# kotlin-native
r
Is it possible to export transitive dependencies to Apple frameworks when using the cocoapods gradle plugin? Can't use the syntax described at https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#exporting-dependencies-to-binaries because the
framework
block is handled internally by the plugin. And doing something like
targets.getByName<KotlinNativeTarget>("ios").binaries.getFramework("DEBUG").transitiveExport = true
doesn't appear to have any effect.
b
it's another binary framework?
usually you'd handle something like this by having it be a dependency in your framework's podspec
r
That doesn't work for kotlin dependencies
s
I did try transitive dependency and I wasn’t able to fully use it. For some reason, it did export some classes ( all where open or abstract) and interface but not all.
r
use-case is having a MPP library referenced in common, and wanting to also talk to it from Swift
b
so you have another mpp binary framework that you're pulling into your main mpp framework project?
r
No, a kotlin thing. A klib
s
Trying to use RXCommon. I created a observable inside my common code and wanted to create the observer inside the iOS code and the observer class wasn’t available in the Swift code
r
Right, that sort of use-case is what I'm thinking of
b
if it's a klib, then export should work
r
With cocoapods? Where do I do it?
b
if it's kotlin build gradle, maybe isTransitiveExport
s
But
isTransitiveExport
does not work as expected
b
no i mean for klibs, the regular export thing should do it
s
Oh ok
r
The regular export thing goes in the
framework
block, which you don't have access to using the cocoapods plugin
b
i think i'd need to see a sample project or some gradle to help guide this
oooh
gotcha. you want to use export, but from the cocoapods plugin, you're having trouble navigating the APIs to get there?
is that right?
r
yeah
b
okay so looks like cocoapods plugin creates a fat framework from multiple targets
so you'll need to collect the iOS targets that create the final framework and then set transitiveExport on those
probably still requires a bit more toying around, but the fact that it uses the fat framework task is a good sign. looks like it's using the standard APIs, so should be possible i think
r
yeah I'll poke around with iterating through the different targets. About to hit a lunch meeting but will check back in when I have a chance to dig in
s
@russhwolf please keep me posted on that if possible.
r
Ok looking again. I think the fat framework config is not where I want to go. That's not actually what's being used in my case because I'm not using arm32. (demoing stuff on KaMPKit which just uses arm64 and x64). What I really want is a way to access this block and add
export()
calls or set
transitiveExport
. Grabbing the framework after the fact and making those calls doesn't seem to have any effect.