Skip to content

Commit 25cf90a

Browse files
authored
Merge pull request #262 from swiftwasm/release/5.3
[pull] swiftwasm-release/5.3 from release/5.3
2 parents ec31464 + 91bdc78 commit 25cf90a

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

Sources/XCBuildSupport/PIFBuilder.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,18 @@ import PackageGraph
2020
/// The parameters required by `PIFBuilder`.
2121
public struct PIFBuilderParameters {
2222

23+
/// Whether or not test discovery is enabled.
24+
public let enableTestDiscovery: Bool
25+
2326
/// Whether to create dylibs for dynamic library products.
2427
public let shouldCreateDylibForDynamicProducts: Bool
2528

2629
/// Creates a `PIFBuilderParameters` instance.
2730
/// - Parameters:
31+
/// - enableTestDiscovery: Whether or not test discovery is enabled.
2832
/// - shouldCreateDylibForDynamicProducts: Whether to create dylibs for dynamic library products.
29-
public init(shouldCreateDylibForDynamicProducts: Bool) {
33+
public init(enableTestDiscovery: Bool, shouldCreateDylibForDynamicProducts: Bool) {
34+
self.enableTestDiscovery = enableTestDiscovery
3035
self.shouldCreateDylibForDynamicProducts = shouldCreateDylibForDynamicProducts
3136
}
3237
}
@@ -299,6 +304,11 @@ final class PackagePIFProjectBuilder: PIFProjectBuilder {
299304
releaseSettings[.DEBUG_INFORMATION_FORMAT] = "dwarf-with-dsym"
300305
releaseSettings[.GCC_OPTIMIZATION_LEVEL] = "s"
301306
releaseSettings[.SWIFT_OPTIMIZATION_LEVEL] = "-Owholemodule"
307+
308+
if parameters.enableTestDiscovery {
309+
releaseSettings[.ENABLE_TESTABILITY] = "YES"
310+
}
311+
302312
addBuildConfiguration(name: "Release", settings: releaseSettings)
303313

304314
for product in package.products.sorted(by: { $0.name < $1.name }) {

Sources/XCBuildSupport/XcodeBuildSystem.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ extension BuildConfiguration {
218218
extension PIFBuilderParameters {
219219
public init(_ buildParameters: BuildParameters) {
220220
self.init(
221+
enableTestDiscovery: buildParameters.enableTestDiscovery,
221222
shouldCreateDylibForDynamicProducts: buildParameters.shouldCreateDylibForDynamicProducts
222223
)
223224
}

Tests/XCBuildSupportTests/PIFBuilderTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2159,6 +2159,7 @@ extension PIFBuilderParameters {
21592159
shouldCreateDylibForDynamicProducts: Bool = false
21602160
) -> Self {
21612161
PIFBuilderParameters(
2162+
enableTestDiscovery: false,
21622163
shouldCreateDylibForDynamicProducts: shouldCreateDylibForDynamicProducts
21632164
)
21642165
}

Utilities/bootstrap

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -472,13 +472,6 @@ def build_swiftpm_with_swiftpm(args):
472472
"--disable-sandbox",
473473
]
474474

475-
build_target = get_build_target(args)
476-
cross_compile_hosts = args.cross_compile_hosts
477-
if build_target == 'x86_64-apple-macosx' and "macosx-arm64" in cross_compile_hosts:
478-
swiftpm_args += ["--arch", "x86_64", "--arch", "arm64"]
479-
elif cross_compile_hosts:
480-
error("cannot cross-compile for %s" % cross_compile_hosts)
481-
482475
call_swiftpm(args, swiftpm_args)
483476

484477
# Setup symlinks that'll allow using swiftpm from the build directory.
@@ -610,6 +603,13 @@ def get_swiftpm_flags(args):
610603
if 'ANDROID_DATA' in os.environ:
611604
build_flags.extend(["-Xswiftc", "-Xcc", "-Xswiftc", "-U_GNU_SOURCE"])
612605

606+
build_target = get_build_target(args)
607+
cross_compile_hosts = args.cross_compile_hosts
608+
if build_target == 'x86_64-apple-macosx' and "macosx-arm64" in cross_compile_hosts:
609+
build_flags += ["--arch", "x86_64", "--arch", "arm64"]
610+
elif cross_compile_hosts:
611+
error("cannot cross-compile for %s" % cross_compile_hosts)
612+
613613
return build_flags
614614

615615
if __name__ == '__main__':

0 commit comments

Comments
 (0)