Open Link184 opened 2 months ago
In your project add:
cocoapods {
pod("FirebaseCore") { version = "10.19.0" }
}
Unfortunately cocoapod dependencies are not transitive so your tests wont be able to find them
@Daeda88 How achieve it with SPM ?
@PRUJA you cannot achieve this with SPM since Kotlin Native has no support for it. The problem with this is not in your iOS project, but rather in the app that gradle builds internally to run tests on. It needs to have the frameworks linked to start, much like your real iOS project. If the cocoapods block is too hefty for you (which I can imagine as it increases build times by a lot) you can manually set it in the block IFF you know the location of your frameworks:
val iosTarget: KotlinNativeTarget.() -> Unit = {
binaries {
getTest("DEBUG").apply {
linkerOpts() // Set link to Framework here
}
}
}
iosX64(iosTarget)
iosArm64(iosTarget)
iosSimulatorArm64(iosTarget)
In our own project we have a separate repo that simply contains the cocoapods block in gradle, and then use it to retrieve the required LinkerOpts for our project:
Use it as:
val podsToAdd = listOf(// add names of pods to link here)
binaries {
getTest("DEBUG").apply {
linkFrameworkSearchPaths(cachedCocoapodsPath) {
it in podsToAdd
}
}
}
Steps to reproduce:
dev.gitlive:firebase-firestore:1.12.0
to common dependenciesiosSimilatorArm64().binaries.framework { isStatic = true }
commonTest
source set:myKmpModule:allTests
Notes: The build is failing only on ios test task, another platform tests are running fine. Looks like
isStatic
andkotlin.mpp.enableCInteropCommonization
flags are not not working on test builds