diff --git a/Package.swift b/Package.swift index 4a22b98e2..43337b0dc 100644 --- a/Package.swift +++ b/Package.swift @@ -55,7 +55,9 @@ let package = Package( ], exclude: ["CMakeLists.txt", "Testing.swiftcrossimport"], cxxSettings: .packageSettings, - swiftSettings: .packageSettings, + swiftSettings: .packageSettings + [ + .enableLibraryEvolution(), + ], linkerSettings: [ .linkedLibrary("execinfo", .when(platforms: [.custom("freebsd"), .openbsd])) ] @@ -114,7 +116,9 @@ let package = Package( "Testing", ], path: "Sources/Overlays/_Testing_CoreGraphics", - swiftSettings: .packageSettings + swiftSettings: .packageSettings + [ + .enableLibraryEvolution(), + ] ), .target( name: "_Testing_Foundation", @@ -123,7 +127,12 @@ let package = Package( ], path: "Sources/Overlays/_Testing_Foundation", exclude: ["CMakeLists.txt"], - swiftSettings: .packageSettings + swiftSettings: .packageSettings + [ + // The Foundation module only has Library Evolution enabled on Apple + // platforms, and since this target's module publicly imports Foundation, + // it can only enable Library Evolution itself on those platforms. + .enableLibraryEvolution(applePlatformsOnly: true), + ] ), ], @@ -186,6 +195,18 @@ extension Array where Element == PackageDescription.SwiftSetting { } } +extension PackageDescription.SwiftSetting { + /// Create a Swift setting which enables Library Evolution, optionally + /// constraining it to only Apple platforms. + /// + /// - Parameters: + /// - applePlatformsOnly: Whether to constrain this setting to only Apple + /// platforms. + static func enableLibraryEvolution(applePlatformsOnly: Bool = false) -> Self { + unsafeFlags(["-enable-library-evolution"], .when(platforms: applePlatformsOnly ? [.macOS, .iOS, .macCatalyst, .watchOS, .tvOS, .visionOS] : [])) + } +} + extension Array where Element == PackageDescription.CXXSetting { /// Settings intended to be applied to every C++ target in this package. /// Analogous to project-level build settings in an Xcode project. diff --git a/Sources/Testing/Running/Configuration.swift b/Sources/Testing/Running/Configuration.swift index f4ae59813..e0c15b6fb 100644 --- a/Sources/Testing/Running/Configuration.swift +++ b/Sources/Testing/Running/Configuration.swift @@ -199,7 +199,7 @@ public struct Configuration: Sendable { /// property is pre-configured. Otherwise, the default value of this property /// records an issue indicating that it has not been configured. @_spi(Experimental) - public var exitTestHandler: ExitTest.Handler = { _ in + public var exitTestHandler: ExitTest.Handler = { exitTest in throw SystemError(description: "Exit test support has not been implemented by the current testing infrastructure.") } #endif