[K/N] Fix FrameworkTest in case of simulator target

As of Xcode 13.1 Swift 5.5 passes wrong libclang_rt to simulator targets
(similar to ours KT-47333). To workaround this problem, we explicitly
provide the correct one.
This commit is contained in:
Sergey Bogolepov
2021-11-29 19:17:06 +03:00
committed by Space
parent 3ef97511f6
commit 10b48296e8
2 changed files with 11 additions and 2 deletions
@@ -169,7 +169,16 @@ open class FrameworkTest : DefaultTask(), KonanTestExecutable {
"-F", frameworkParentDirPath,
"-Xcc", "-Werror" // To fail compilation on warnings in framework header.
)
compileSwift(project, project.testTarget, sources, options + swiftExtraOpts, Paths.get(executable), fullBitcode)
// As of Xcode 13.1 swift passes wrong libclang_rt to simulator targets (similar to KT-47333).
// To workaround this problem, we explicitly provide the correct one.
val simulatorHack = if (project.testTargetConfigurables.targetTriple.isSimulator) {
project.platformManager.platform(project.testTarget).linker.provideCompilerRtLibrary("")?.let {
listOf("-Xlinker", it)
} ?: emptyList()
} else {
emptyList()
}
compileSwift(project, project.testTarget, sources, options + simulatorHack + swiftExtraOpts, Paths.get(executable), fullBitcode)
}
@TaskAction
@@ -94,7 +94,7 @@ abstract class LinkerFlags(val configurables: Configurables) {
return libraries
}
protected open fun provideCompilerRtLibrary(libraryName: String, isDynamic: Boolean = false): String? {
open fun provideCompilerRtLibrary(libraryName: String, isDynamic: Boolean = false): String? {
System.err.println("Can't provide $libraryName.")
return null
}