Skip to content

Commit a07af08

Browse files
committed
[5.5] Only pass -enable-library-evolution for PackageDescription and PackagePlugin on macOS
Because PackageDescription unintentionally exports Foundation (for which a fix was attempted but then reverted after it broke some packages), we can only enable library evolution on Darwin platforms. rdar://78827075 (cherry picked from commit 6e7bb87)
1 parent a253a54 commit a07af08

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ let package = Package(
120120
name: "PackageDescription",
121121
swiftSettings: [
122122
.unsafeFlags(["-package-description-version", "999.0"]),
123-
.unsafeFlags(["-enable-library-evolution"])
123+
.unsafeFlags(["-enable-library-evolution"], .when(platforms: [.macOS]))
124124
]),
125125

126126
// The `PackagePlugin` target provides the API that is available to
@@ -130,7 +130,7 @@ let package = Package(
130130
name: "PackagePlugin",
131131
swiftSettings: [
132132
.unsafeFlags(["-package-description-version", "999.0"]),
133-
.unsafeFlags(["-enable-library-evolution"])
133+
.unsafeFlags(["-enable-library-evolution"], .when(platforms: [.macOS]))
134134
]),
135135

136136
// MARK: SwiftPM specific support libraries

Sources/PackageDescription/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ add_library(PackageDescription
2121

2222
target_compile_options(PackageDescription PUBLIC
2323
$<$<COMPILE_LANGUAGE:Swift>:-package-description-version$<SEMICOLON>999.0>)
24-
target_compile_options(PackageDescription PUBLIC
25-
$<$<COMPILE_LANGUAGE:Swift>:-enable-library-evolution>)
2624

2725
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
26+
target_compile_options(PackageDescription PUBLIC
27+
$<$<COMPILE_LANGUAGE:Swift>:-enable-library-evolution>)
2828
set(SWIFT_INTERFACE_PATH ${CMAKE_BINARY_DIR}/pm/ManifestAPI/PackageDescription.swiftinterface)
2929
target_compile_options(PackageDescription PUBLIC
3030
$<$<COMPILE_LANGUAGE:Swift>:-emit-module-interface-path$<SEMICOLON>${SWIFT_INTERFACE_PATH}>)

Sources/PackagePlugin/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ add_library(PackagePlugin
1717

1818
target_compile_options(PackagePlugin PUBLIC
1919
$<$<COMPILE_LANGUAGE:Swift>:-package-description-version$<SEMICOLON>999.0>)
20-
target_compile_options(PackagePlugin PUBLIC
21-
$<$<COMPILE_LANGUAGE:Swift>:-enable-library-evolution>)
2220

2321
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
22+
target_compile_options(PackagePlugin PUBLIC
23+
$<$<COMPILE_LANGUAGE:Swift>:-enable-library-evolution>)
2424
set(SWIFT_INTERFACE_PATH ${CMAKE_BINARY_DIR}/pm/PluginAPI/PackagePlugin.swiftinterface)
2525
target_compile_options(PackagePlugin PUBLIC
2626
$<$<COMPILE_LANGUAGE:Swift>:-emit-module-interface-path$<SEMICOLON>${SWIFT_INTERFACE_PATH}>)

0 commit comments

Comments
 (0)