Skip to content

Commit 603a568

Browse files
authored
Work around macOS build failures affecting test targets (#1139)
This applies a workaround to fix macOS builds (including CI) which began failing due to a Swift compiler regression which is expected to be resolved by swiftlang/swift#82034. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent ca81dff commit 603a568

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

Package.swift

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ let package = Package(
129129
"_Testing_Foundation",
130130
"MemorySafeTestingTests",
131131
],
132-
swiftSettings: .packageSettings
132+
swiftSettings: .packageSettings + .disableMandatoryOptimizationsSettings
133133
),
134134

135135
// Use a plain `.target` instead of a `.testTarget` to avoid the unnecessary
@@ -234,7 +234,7 @@ package.targets.append(contentsOf: [
234234
"Testing",
235235
"TestingMacros",
236236
],
237-
swiftSettings: .packageSettings
237+
swiftSettings: .packageSettings + .disableMandatoryOptimizationsSettings
238238
)
239239
])
240240
#endif
@@ -290,7 +290,10 @@ extension Array where Element == PackageDescription.SwiftSetting {
290290
// This setting is enabled in the package, but not in the toolchain build
291291
// (via CMake). Enabling it is dependent on acceptance of the @section
292292
// proposal via Swift Evolution.
293-
.enableExperimentalFeature("SymbolLinkageMarkers"),
293+
//
294+
// FIXME: Re-enable this once a CI blocker is resolved:
295+
// https://github.com/swiftlang/swift-testing/issues/1138.
296+
// .enableExperimentalFeature("SymbolLinkageMarkers"),
294297

295298
// This setting is no longer needed when building with a 6.2 or later
296299
// toolchain now that SE-0458 has been accepted and implemented, but it is
@@ -382,6 +385,20 @@ extension Array where Element == PackageDescription.SwiftSetting {
382385
[]
383386
#endif
384387
}
388+
389+
/// Settings which disable Swift's mandatory optimizations pass.
390+
///
391+
/// This is intended only to work around a build failure caused by a Swift
392+
/// compiler regression which is expected to be resolved in
393+
/// [swiftlang/swift#82034](https://github.com/swiftlang/swift/pull/82034).
394+
///
395+
/// @Comment {
396+
/// - Bug: This should be removed once the CI issue is resolved.
397+
/// [swiftlang/swift-testin#1138](https://github.com/swiftlang/swift-testing/issues/1138).
398+
/// }
399+
static var disableMandatoryOptimizationsSettings: Self {
400+
[.unsafeFlags(["-Xllvm", "-sil-disable-pass=mandatory-performance-optimizations"])]
401+
}
385402
}
386403

387404
extension Array where Element == PackageDescription.CXXSetting {

0 commit comments

Comments
 (0)