Native: remove bitcode embedding from tests

Xcode 14 deprecates bitcode embedding, and Xcode 15 removes support
for it. Therefore, testing bitcode embedding in Kotlin doesn't make
much sense.

This commit removes most of test code that enables bitcode.

^KT-61875
This commit is contained in:
Svyatoslav Scherbina
2023-11-23 18:36:59 +00:00
committed by Space Team
parent 957d3c5610
commit e5ae32c37a
3 changed files with 3 additions and 17 deletions
@@ -4999,7 +4999,6 @@ Task frameworkTest(String name, Closure<FrameworkTest> configurator) {
UtilsKt.dependsOnKonanBuildingTask(task, library, target) UtilsKt.dependsOnKonanBuildingTask(task, library, target)
} }
extraOpts fr.bitcode ? "-Xembed-bitcode" : "-Xembed-bitcode-marker"
if (fr.isStatic) extraOpts "-Xstatic-framework" if (fr.isStatic) extraOpts "-Xstatic-framework"
extraOpts fr.opts extraOpts fr.opts
extraOpts project.globalTestArgs extraOpts project.globalTestArgs
@@ -5096,7 +5095,6 @@ Task objcExportTest(
sources = ['objcexport'] sources = ['objcexport']
libraries = [libraryName, noEnumEntriesLibraryName] libraries = [libraryName, noEnumEntriesLibraryName]
artifact = 'Kt' artifact = 'Kt'
bitcode = !isStaticFramework
isStatic = isStaticFramework isStatic = isStaticFramework
if (needLazyHeaderCheck) { if (needLazyHeaderCheck) {
opts += "-Xemit-lazy-objc-header=$lazyHeader" opts += "-Xemit-lazy-objc-header=$lazyHeader"
@@ -5187,9 +5185,7 @@ if (isAppleTarget(project)) {
frameworkTest("testStdlibFramework") { frameworkTest("testStdlibFramework") {
framework('Stdlib') { framework('Stdlib') {
sources = ['framework/stdlib'] sources = ['framework/stdlib']
bitcode = true
} }
if (cacheTesting == null) fullBitcode = true
swiftSources = ['framework/stdlib/'] swiftSources = ['framework/stdlib/']
} }
@@ -5198,11 +5194,9 @@ if (isAppleTarget(project)) {
} else frameworkTest("testMultipleFrameworks") { } else frameworkTest("testMultipleFrameworks") {
framework('First') { framework('First') {
sources = ['framework/multiple/framework1', 'framework/multiple/shared'] sources = ['framework/multiple/framework1', 'framework/multiple/shared']
bitcode = true
} }
framework('Second') { framework('Second') {
sources = ['framework/multiple/framework2', 'framework/multiple/shared'] sources = ['framework/multiple/framework2', 'framework/multiple/shared']
bitcode = true
} }
swiftSources = ['framework/multiple'] swiftSources = ['framework/multiple']
} }
@@ -5217,14 +5211,12 @@ if (isAppleTarget(project)) {
framework('FirstStatic') { framework('FirstStatic') {
artifact = 'First' artifact = 'First'
sources = ['framework/multiple/framework1', 'framework/multiple/shared'] sources = ['framework/multiple/framework1', 'framework/multiple/shared']
bitcode = true
isStatic = true isStatic = true
opts = ['-Xstatic-framework', "-Xpre-link-caches=enable"] opts = ['-Xstatic-framework', "-Xpre-link-caches=enable"]
} }
framework('SecondStatic') { framework('SecondStatic') {
artifact = 'Second' artifact = 'Second'
sources = ['framework/multiple/framework2', 'framework/multiple/shared'] sources = ['framework/multiple/framework2', 'framework/multiple/shared']
bitcode = true
isStatic = true isStatic = true
opts = ['-Xstatic-framework', "-Xpre-link-caches=enable"] opts = ['-Xstatic-framework', "-Xpre-link-caches=enable"]
} }
@@ -36,9 +36,6 @@ open class FrameworkTest : DefaultTask(), KonanTestExecutable {
@Input @Input
lateinit var frameworks: MutableList<Framework> lateinit var frameworks: MutableList<Framework>
@Input
var fullBitcode: Boolean = false
@Input @Input
var codesign: Boolean = true var codesign: Boolean = true
@@ -53,7 +50,6 @@ open class FrameworkTest : DefaultTask(), KonanTestExecutable {
* *
* @param name is the framework name, * @param name is the framework name,
* @param sources framework sources, * @param sources framework sources,
* @param bitcode bitcode embedding in the framework,
* @param isStatic determines that framework is static * @param isStatic determines that framework is static
* @param artifact the name of the resulting artifact, * @param artifact the name of the resulting artifact,
* @param library list of library dependency names, * @param library list of library dependency names,
@@ -62,7 +58,6 @@ open class FrameworkTest : DefaultTask(), KonanTestExecutable {
class Framework( class Framework(
val name: String, val name: String,
var sources: List<String> = emptyList(), var sources: List<String> = emptyList(),
var bitcode: Boolean = false,
var isStatic: Boolean = false, var isStatic: Boolean = false,
var artifact: String = name, var artifact: String = name,
var libraries: List<String> = emptyList(), var libraries: List<String> = emptyList(),
@@ -176,7 +171,7 @@ open class FrameworkTest : DefaultTask(), KonanTestExecutable {
} else { } else {
emptyList() emptyList()
} }
compileSwift(project, project.testTarget, sources, options + simulatorHack + swiftExtraOpts, Paths.get(executable), fullBitcode) compileSwift(project, project.testTarget, sources, options + simulatorHack + swiftExtraOpts, Paths.get(executable))
} }
@TaskAction @TaskAction
@@ -286,7 +286,7 @@ fun Task.dependsOnKonanBuildingTask(artifact: String, target: KonanTarget) {
@JvmOverloads @JvmOverloads
fun compileSwift( fun compileSwift(
project: Project, target: KonanTarget, sources: List<String>, options: List<String>, project: Project, target: KonanTarget, sources: List<String>, options: List<String>,
output: Path, fullBitcode: Boolean = false output: Path
) { ) {
val platform = project.platformManager.platform(target) val platform = project.platformManager.platform(target)
assert(platform.configurables is AppleConfigurables) assert(platform.configurables is AppleConfigurables)
@@ -300,8 +300,7 @@ fun compileSwift(
val swiftTarget = configs.targetTriple.withOSVersion(configs.osVersionMin).toString() val swiftTarget = configs.targetTriple.withOSVersion(configs.osVersionMin).toString()
val args = listOf("-sdk", configs.absoluteTargetSysRoot, "-target", swiftTarget) + val args = listOf("-sdk", configs.absoluteTargetSysRoot, "-target", swiftTarget) +
options + "-o" + output.toString() + sources + options + "-o" + output.toString() + sources
if (fullBitcode) listOf("-embed-bitcode", "-Xlinker", "-bitcode_verify") else listOf("-embed-bitcode-marker")
val (stdOut, stdErr, exitCode) = runProcess( val (stdOut, stdErr, exitCode) = runProcess(
executor = localExecutor(project), executable = compiler, args = args, executor = localExecutor(project), executable = compiler, args = args,