mkrussel
12/03/2020, 4:35 PMkotlin {
ios {
val frameworkLocation = File(rootDir, "native/TestApp/Pods/Mapbox-iOS-SDK/dynamic/").absolutePath
val frameworks = "-F$frameworkLocation"
binaries.configureEach {
linkerOpts(frameworks)
}
}
}
I get the following error when it runs the tests.
dyld: Library not loaded: @rpath/Mapbox.framework/Mapbox
Referenced from: /Users/mkrussel/pangea/pangea-android/test-app-shared/build/bin/iosX64/debugTest/test.kexe
Reason: image not found
alex009
12/04/2020, 1:57 AMval frameworksPath =
"${rootProject.buildDir.absolutePath}/cocoapods/UninstalledProducts/iphonesimulator"
environment("SIMCTL_CHILD_DYLD_FRAMEWORK_PATH", frameworksPath)
try do it in doFirst for test task. and fix path to youralex009
12/04/2020, 1:57 AM// now standard test task use --standalone but it broke network calls
val newTestTask = tasks.create("iosX64TestWithNetwork") {
val linkTask =
tasks.getByName("linkDebugTestIosX64") as org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink
dependsOn(linkTask)
group = JavaBasePlugin.VERIFICATION_GROUP
description = "Runs tests for target 'ios' on an iOS simulator"
doLast {
val binary = linkTask.binary.outputFile
val device = "iPhone 8"
exec {
commandLine = listOf("xcrun", "simctl", "boot", device)
isIgnoreExitValue = true
}
exec {
val frameworksPath =
"${rootProject.buildDir.absolutePath}/cocoapods/UninstalledProducts/iphonesimulator"
environment("SIMCTL_CHILD_DYLD_FRAMEWORK_PATH", frameworksPath)
commandLine = listOf(
"xcrun",
"simctl",
"spawn",
device,
binary.absolutePath
)
}
exec {
commandLine = listOf("xcrun", "simctl", "shutdown", device)
}
}
}
with(tasks.getByName("iosX64Test")) {
dependsOn(newTestTask)
onlyIf { false }
}
mkrussel
12/04/2020, 4:16 PMmkrussel
12/04/2020, 6:48 PMtasks.withType(KotlinNativeTest::class.java) {
environment("SIMCTL_CHILD_DYLD_FRAMEWORK_PATH", frameworkLocation)
}
This doesn't open a visible simulator and generates the test results.