icerockdev / moko-test

Test utilities for mobile (android & ios) Kotlin Multiplatform development
https://moko.icerock.dev/
Apache License 2.0
12 stars 1 forks source link

Add plugin with link cocoapods to test ios executable #1

Closed Alex009 closed 3 years ago

Alex009 commented 3 years ago

code from project:

kotlin {
    targets
        .matching { it is org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget }
        .configureEach {
            val target = this as org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
            val sdk = when (target.konanTarget) {
                org.jetbrains.kotlin.konan.target.KonanTarget.IOS_X64 -> "iphonesimulator"
                else -> "iphoneos"
            }

            rootProject.tasks
                .matching { it is dev.icerock.gradle.tasks.CompileCocoaPod && it.compileSdk == sdk }
                .configureEach {
                    val compileCocoaPod = this as dev.icerock.gradle.tasks.CompileCocoaPod

                    val frameworksPath = compileCocoaPod.frameworksDir
                    target.binaries.configureEach {
                        linkerOpts("-F$frameworksPath")
                    }
                }
        }
}
Alex009 commented 3 years ago

implemented in https://github.com/icerockdev/mobile-multiplatform-gradle-plugin/pull/34