agta1991
09/10/2020, 8:43 AMagta1991
09/10/2020, 8:43 AM> Task :shared:firebase:auth:linkDebugTestIosX64 FAILED
e: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors
The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.
output:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_FIRAuthDataResult", referenced from:
objc-class-ref in result.o
"_OBJC_CLASS_$_FIRAuth", referenced from:
objc-class-ref in result.o
"_OBJC_CLASS_$_FIREmailAuthProvider", referenced from:
objc-class-ref in result.o
"_OBJC_CLASS_$_FIRAuthTokenResult", referenced from:
objc-class-ref in result.o
"_OBJC_CLASS_$_FIRUser", referenced from:
objc-class-ref in result.o
"_FIRAuthErrorDomain", referenced from:
_cocoapods_FirebaseAuth_FIRAuthErrorDomain_getter_wrapper0 in result.o
ld: symbol(s) not found for architecture x86_64
FAILURE: Build failed with an exception.
agta1991
09/10/2020, 8:44 AMalex009
09/10/2020, 8:47 AMval frameworksPath = "${buildDir.absolutePath}/cocoapods/UninstalledProducts/iphonesimulator"
kotlin {
targets
.filterIsInstance<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>()
.forEach { target ->
target.binaries.forEach { binary ->
binary.linkerOpts("-F$frameworksPath")
}
}
}
// now standard test task use --standalone but it broke network calls
with(tasks.replace("iosX64Test")) {
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 {
environment("SIMCTL_CHILD_DYLD_FRAMEWORK_PATH", frameworksPath)
commandLine = listOf(
"xcrun",
"simctl",
"spawn",
device,
binary.absolutePath
)
}
exec {
commandLine = listOf("xcrun", "simctl", "shutdown", device)
}
}
}