Does anybody know if there’s a way to config libra...
# multiplatform
k
Does anybody know if there’s a way to config library exports for native with cocoapods? You can config that on frameworks without cocoapods, but not sure with
Copy code
binaries {
    framework {
        export project(':dependency')
        // Export transitively.
        transitiveExport = true
    }
}
Config block from here: https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html
a
should work with cocoapods. you test it and not see exported classes or not test yet?
k
Once you add “framework” to the config block, there’s an error saying that framework already exists, because cocoapods creates it. However, the answer was right there in front of me. The config to allow symbolication in release needs some framework config
Copy code
iosX64("ios"){
            binaries.all {
                freeCompilerArgs += "-Xg0"
                if(it instanceof org.jetbrains.kotlin.gradle.plugin.mpp.Framework) {
                    isStatic = true
                }
            }
        }
I just added the
export
line to that.
Copy code
iosX64("ios"){
            binaries.all {
                freeCompilerArgs += "-Xg0"
                if(it instanceof org.jetbrains.kotlin.gradle.plugin.mpp.Framework) {
                    isStatic = true
                    export 'co.touchlab:crashkios:0.2.2'
                }
            }
        }
Just using
export
doesn’t actually work. I don’t see those classes in the output. Adding
transitiveExport = true
triggers an error that the exported dependency needs to be an
api
dependency. Changing that works, but then I get a compiler error that is really weird. I’m working off of Kotlin Native master, though, so issues aren’t a huge surprise.
a
you use
cocoapods
gradle plugin by what reason? only for podspec generation or to connect pods into kotlin?
k
This is just a sample project for a library, so I might be able to work around it, but will need to be able to use
cocoapods
The library lets you send symbolicated crash reports to crashlytics and bugsnag! However, there’s not much code, and none of it needs to be in the project’s kotlin. In swift you set up the crash handler. That calls into the library’s Kotlin. Need to force that to be included. For now I’m going to add a passthrough Kotlin method in the project kotlin so the compiler includes it.
f
Hi @kpgalligan, have you finally solved this scenario? For me this approach https://github.com/JetBrains/kotlin-native/issues/3208#issuecomment-514599882 has worked.