Skip to content

Commit

Permalink
[SR-14718 ] Only pass -enable-library-evolution for PackageDescript…
Browse files Browse the repository at this point in the history
…ion 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
  • Loading branch information
abertelrud committed Jun 3, 2021
1 parent 64bb972 commit 1998284
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Expand Up @@ -115,7 +115,7 @@ let package = Package(
name: "PackageDescription",
swiftSettings: [
.unsafeFlags(["-package-description-version", "999.0"]),
.unsafeFlags(["-enable-library-evolution"])
.unsafeFlags(["-enable-library-evolution"], .when(platforms: [.macOS]))
]),

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

// MARK: SwiftPM specific support libraries
Expand Down
4 changes: 2 additions & 2 deletions Sources/PackageDescription/CMakeLists.txt
Expand Up @@ -21,10 +21,10 @@ add_library(PackageDescription

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

if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
target_compile_options(PackageDescription PUBLIC
$<$<COMPILE_LANGUAGE:Swift>:-enable-library-evolution>)
set(SWIFT_INTERFACE_PATH ${CMAKE_BINARY_DIR}/pm/ManifestAPI/PackageDescription.swiftinterface)
target_compile_options(PackageDescription PUBLIC
$<$<COMPILE_LANGUAGE:Swift>:-emit-module-interface-path$<SEMICOLON>${SWIFT_INTERFACE_PATH}>)
Expand Down
4 changes: 2 additions & 2 deletions Sources/PackagePlugin/CMakeLists.txt
Expand Up @@ -17,10 +17,10 @@ add_library(PackagePlugin

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

if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
target_compile_options(PackagePlugin PUBLIC
$<$<COMPILE_LANGUAGE:Swift>:-enable-library-evolution>)
set(SWIFT_INTERFACE_PATH ${CMAKE_BINARY_DIR}/pm/PluginAPI/PackagePlugin.swiftinterface)
target_compile_options(PackagePlugin PUBLIC
$<$<COMPILE_LANGUAGE:Swift>:-emit-module-interface-path$<SEMICOLON>${SWIFT_INTERFACE_PATH}>)
Expand Down

0 comments on commit 1998284

Please sign in to comment.