Skip to content

Commit 6e7bb87

Browse files
committed
[SR-14718 ] 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
1 parent 30f8a7f commit 6e7bb87

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
@@ -115,7 +115,7 @@ let package = Package(
115115
name: "PackageDescription",
116116
swiftSettings: [
117117
.unsafeFlags(["-package-description-version", "999.0"]),
118-
.unsafeFlags(["-enable-library-evolution"])
118+
.unsafeFlags(["-enable-library-evolution"], .when(platforms: [.macOS]))
119119
]),
120120

121121
// The `PackagePlugin` target provides the API that is available to
@@ -125,7 +125,7 @@ let package = Package(
125125
name: "PackagePlugin",
126126
swiftSettings: [
127127
.unsafeFlags(["-package-description-version", "999.0"]),
128-
.unsafeFlags(["-enable-library-evolution"])
128+
.unsafeFlags(["-enable-library-evolution"], .when(platforms: [.macOS]))
129129
]),
130130

131131
// 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)