Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ios test task is failing with: "Id: framework not found FirebaseCore" #499

Open
Link184 opened this issue Apr 28, 2024 · 4 comments
Open

Comments

@Link184
Copy link

Link184 commented Apr 28, 2024

Steps to reproduce:

  1. add dev.gitlive:firebase-firestore:1.12.0 to common dependencies
  2. optional step to fix normal ios builds: add iosSimilatorArm64().binaries.framework { isStatic = true }
  3. make sure you have at least 1 test defined in commonTest source set
  4. run :myKmpModule:allTests

Notes:
The build is failing only on ios test task, another platform tests are running fine.
Looks like isStatic and kotlin.mpp.enableCInteropCommonization flags are not not working on test builds

@Daeda88
Copy link
Contributor

Daeda88 commented May 3, 2024

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

@ghost
Copy link

ghost commented Jun 6, 2024

@Daeda88 How achieve it with SPM ?

@Daeda88
Copy link
Contributor

Daeda88 commented Jun 6, 2024

@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)

@Daeda88
Copy link
Contributor

Daeda88 commented Jun 6, 2024

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:

https://pl.kotl.in/LaYzHO_uX

Use it as:

val podsToAdd = listOf(// add names of pods to link here)
binaries {
    getTest("DEBUG").apply {
        linkFrameworkSearchPaths(cachedCocoapodsPath) {
            it in podsToAdd
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants