Hey guys, I am building iOS fat framework and ever...
# kotlin-native
c
Hey guys, I am building iOS fat framework and everything seems to be working fine on my iOS app. However I have this warning in the build logs:
w: Interop library /pathToUser/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-io-iosarm64/0.1.14/1ece4fc59ccddcacf23bb04589c7c0f39a94b787/kotlinx-io-cinterop-sockets can't be exported with -Xexport-library
. Will I experience runtime crashes ? what does it mean exactly for the framework produced ?
k
it means whatever framework you're depending on via cinterop in your MPP will also need to be linked into your app
s
No. It means that you are trying to export
cinterop
-provided library using
export
in Gradle DSL. You most likely don’t need this.
c
there is no
cinterop
code in the code I wrote so I assume these are indirect dependencies. this is the initial problem I had: I have 2 mpp modules A and B. B is using A as a dependency. I produced FAT frameworks from both of them, and include both framework in my iOS app. Everything is good so far. The problem is I have a type in module A Type1 which is used in module 2. But in my ios App if I try to use them together I have an incompatibility error where A.Type1 is said to be incompatible with B.Type1. Whereas they are supposed to be the exactly the same. How can I solve that?
and I solved it this way:
Copy code
// this is module A gradle file
iosArm32("ios32") {
        binaries {
            framework(){
                export project(":module_B")
                transitiveExport=true
            }
        }
    }
s
so I assume these are indirect dependencies
May be.
I have 2 mpp modules A and B. B is using A as a dependency.
Why do you enable
transitiveExport
then?
k
you cannot link an iOS app with 2 MPP frameworks
but since you are exporting B from A's framework, you don't need to do that, correct?
c
Yes correct, I am importing only one framework. B, since it “contains” A as well.
I assume that I had to use
transitiveExport=true
so that the indirect dependencies are also exported. I forgot to mention that A depends on multi platform library that is published with gradle metadata
k
are there any
api
dependencies?
also as to your original question, no that warning should not cause any issue
s
. I forgot to mention that A depends on multi platform library that is published with gradle metadata
Does
transitiveExport
affect exporting dependencies of A here?
c
@Kris Wong no I do not have any
api
dependency
@svyatoslav.scherbina if I removed the
transitiveExport
then the multiplatform lib published with gradle metadata is not packaged and I have a compilation error in my iOS app
s
Your initial description lacks any mention of “the multiplatform lib published with gradle metadata”. Instead it features
A
and
B
which both are Gradle projects.
c
Yes you are right I have 3 multi platform project. A,b and C. C is published with gradle metadata. A and B are part of the same projects and are both multiplatform modules. C is an implementation dependency of B. And B is an API dependency of A. I want to publish A as a fat framework and for that I need both
transitiveExport=true
and
export project B
otherwise I lack some of the dependency
s
otherwise I lack some of the dependency
What is “dependency” here? What do you mean by “lack”? Where is this “dependency” defined?
c
It means when importing the project on the iOS project some of the transitive dependency are not found
s
Sorry, this explanation is not clear enough, I can’t help.