Marc Dietrichstein
03/25/2020, 8:58 AMlinkerOpts
and compilerOpts
in my cinterop.def
file (FirebaseCore, nanobp etc.) This also leads to "duplicate symbol" issues when the framework is embedded in our app, since we are using cocoapods which pulls in transitive dependencies that are already embedded in our analytics library.
Is there any cinterop flag or gradle option to tell kotlin not to embed subframeworks?ilya.matveev
03/25/2020, 9:44 AMorg.jetbrains.kotlin.native.cocoapods
plugin or configure cinterop manually?
Could you also provide your buildscript? It would help to find a correct root cause for your problem.Marc Dietrichstein
03/25/2020, 9:57 AMkotlin {
data class IosTarget(
val name: String, val preset: String, val id: String,
val embedBitcode: Framework.BitcodeEmbeddingMode
)
val iosTargets = listOf(
IosTarget("ios", "iosArm64", "ios-arm64", Framework.BitcodeEmbeddingMode.BITCODE),
IosTarget("iosSim", "iosX64", "ios-x64", Framework.BitcodeEmbeddingMode.DISABLE)
)
for ((targetName, presetName, id, bitcodeEmbeddingMode) in iosTargets) {
targetFromPreset(presets.getByName(presetName), targetName) {
(this as KotlinNativeTarget).run {
compilations {
val main by getting {
val carthageBuildDir = "$projectDir/Carthage/Build/iOS"
cinterops(Action {
val firebaseAnalytics by creating {
defFile("src/iosMain/cinterop/firebaseAnalytics.def")
includeDirs.allHeaders("$carthageBuildDir/FirebaseAnalytics.framework/Headers")
}
})
binaries {
framework {
baseName = "OurFramework"
embedBitcode(bitcodeEmbeddingMode)
}
}
}
}
}
}
}
}
Build Framework Task:
tasks.register("buildUniversalFrameworkRelease", FatFrameworkTask::class.java) {
baseName = "OurFramework"
from(
(kotlin.targets.getByName("ios") as KotlinNativeTarget).binaries.getFramework(NativeBuildType.RELEASE),
(kotlin.targets.getByName("iosSim") as KotlinNativeTarget).binaries.getFramework(NativeBuildType.RELEASE)
)
destinationDir = buildDir.resolve("xcode-frameworks")
}
cinterop:
package = framework.FirebaseAnalytics
language = Objective-C
headers = FirebaseAnalytics.h
compilerOpts = -F ./Carthage/Build/iOS -framework FIRAnalyticsConnector -framework FirebaseCore -framework GoogleDataTransportCCTSupport -framework nanopb -framework Firebase -framework FirebaseCoreDiagnostics -framework GoogleAppMeasurement -framework GoogleUtilities -framework FirebaseAnalytics -framework FirebaseInstallations -framework GoogleDataTransport -framework PromisesObjC -lsqlite3 -framework StoreKit
linkerOpts = -ObjC -F ./Carthage/Build/iOS -framework FIRAnalyticsConnector -framework FirebaseCore -framework GoogleDataTransportCCTSupport -framework nanopb -framework FirebaseCoreDiagnostics -framework GoogleAppMeasurement -framework GoogleUtilities -framework FirebaseAnalytics -framework FirebaseInstallations -framework GoogleDataTransport -framework PromisesObjC -lsqlite3 -framework StoreKit
Marc Dietrichstein
03/25/2020, 9:59 AMar archives
which means that they are static libraries 🙄Marc Dietrichstein
03/25/2020, 9:59 AMilya.matveev
03/25/2020, 10:03 AMisStatic = true
in the binaries.framework
block.