Skip to content

Adopt MemberImportVisibility #8525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4eba6bd
Adopt MemberImportVisiblity - PackageDescription
plemarquand Apr 13, 2025
ac025bc
Adopt MemberImportVisiblity - AppleProductTypes
plemarquand Apr 13, 2025
5066e93
Adopt MemberImportVisiblity - PackagePlugin
plemarquand Apr 13, 2025
9b6cd68
Adopt MemberImportVisiblity - SourceKitLSPAPI
plemarquand Apr 13, 2025
8269986
Adopt MemberImportVisiblity - _AsyncFileSystem
plemarquand Apr 13, 2025
decb07a
Adopt MemberImportVisiblity - Basics
plemarquand Apr 13, 2025
a046607
Adopt MemberImportVisiblity - LLBuildManifest
plemarquand Apr 13, 2025
28bfbc6
Adopt MemberImportVisiblity - PackageRegistry
plemarquand Apr 13, 2025
562eb1c
Adopt MemberImportVisiblity - SourceControl
plemarquand Apr 13, 2025
bda8eec
Adopt MemberImportVisiblity - SPMLLBuild
plemarquand Apr 13, 2025
faa3b49
Adopt MemberImportVisiblity - PackageModel
plemarquand Apr 13, 2025
3fec67d
Adopt MemberImportVisiblity - PackageModelSyntax
plemarquand Apr 13, 2025
bbf8cd9
Adopt MemberImportVisiblity - PackageLoading
plemarquand Apr 13, 2025
9212ad4
Adopt MemberImportVisiblity - PackageGraph
plemarquand Apr 14, 2025
f40e214
Adopt MemberImportVisiblity - PackageCollectionsModel
plemarquand Apr 14, 2025
cc152fd
Adopt MemberImportVisiblity - PackageCollections
plemarquand Apr 14, 2025
5915448
Adopt MemberImportVisiblity - PackageCollectionsSigning
plemarquand Apr 14, 2025
c8ff19c
Adopt MemberImportVisiblity - PackageFingerprint
plemarquand Apr 14, 2025
47910d5
Adopt MemberImportVisiblity - PackageSigning
plemarquand Apr 14, 2025
034a721
Adopt MemberImportVisiblity - SPMBuildCore
plemarquand Apr 15, 2025
e3ab583
Adopt MemberImportVisiblity - Build
plemarquand Apr 15, 2025
7cae693
Adopt MemberImportVisiblity - DriverSupport
plemarquand Apr 15, 2025
6f648e1
Adopt MemberImportVisiblity - XCBuildSupport
plemarquand Apr 15, 2025
d369f88
Adopt MemberImportVisiblity - SwiftBuildSupport
plemarquand Apr 15, 2025
48583c9
Adopt MemberImportVisiblity - Workspace
plemarquand Apr 15, 2025
8d90be8
Adopt MemberImportVisiblity - PackageMetadata
plemarquand Apr 15, 2025
1b24664
Adopt MemberImportVisiblity - CoreCommands
plemarquand Apr 15, 2025
e7b9b1c
Adopt MemberImportVisiblity - Commands
plemarquand Apr 15, 2025
0676ca7
Adopt MemberImportVisiblity - SwiftSDKCommand
plemarquand Apr 15, 2025
dcf528c
Adopt MemberImportVisiblity - PackageCollectionsCommand
plemarquand Apr 15, 2025
835852a
Adopt MemberImportVisiblity - PackageRegistryCommand
plemarquand Apr 15, 2025
4a7e73c
Adopt MemberImportVisiblity - CompilerPluginSupport
plemarquand Apr 15, 2025
52e6839
Adopt MemberImportVisiblity - PackageGraphTests
plemarquand Apr 16, 2025
a96a733
Cleanup
plemarquand Apr 17, 2025
32d6aff
Refactor out settings in to a variable, don't use MemberImportVisibil…
plemarquand Apr 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 48 additions & 33 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ if let resourceDirPath = ProcessInfo.processInfo.environment["SWIFTCI_INSTALL_RP
packageLibraryLinkSettings = []
}

// Common experimental flags to be added to all targets.
let commonExperimentalFeatures: [SwiftSetting] = [
.enableExperimentalFeature("MemberImportVisibility"),
]

// Certain targets fail to compile with MemberImportVisibility enabled on 6.0.3
// but work with >=6.1. These targets opt in to using `swift6CompatibleExperimentalFeatures`.
#if swift(>=6.1)
let swift6CompatibleExperimentalFeatures = commonExperimentalFeatures
#else
let swift6CompatibleExperimentalFeatures: [SwiftSetting] = []
#endif

/** SwiftPMDataModel is the subset of SwiftPM product that includes just its data model.
This allows some clients (such as IDEs) that use SwiftPM's data model but not its build system
to not have to depend on SwiftDriver, SwiftLLBuild, etc. We should probably have better names here,
Expand Down Expand Up @@ -152,7 +165,7 @@ let package = Package(
.target(
name: "PackageDescription",
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: should we be using swift6CompatibleExperimentalFeatures instead of commonExperimentalFeatures in the event a developer is using Swift 6.0.x to build the project?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want these to apply to any toolchain. The swift6CompatibleExperimentalFeatures var only exists for targets that currently fail to build with MemberImportVisibility on in 6.0.3.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we understand why those targets fail to build on 6.0.3? Can we raise an issue to ensure we get this addressed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They don't fail on 6.1, so my assumption is it's already fixed.

.define("USE_IMPL_ONLY_IMPORTS"),
.unsafeFlags(["-package-description-version", "999.0"]),
.unsafeFlags(["-enable-library-evolution"]),
Expand All @@ -169,7 +182,7 @@ let package = Package(
// AppleProductTypes library when they import it without further
// messing with the manifest loader.
dependencies: ["PackageDescription"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-package-description-version", "999.0"]),
.unsafeFlags(["-enable-library-evolution"], .when(platforms: [.macOS])),
.unsafeFlags(["-Xfrontend", "-module-link-name", "-Xfrontend", "AppleProductTypes"])
Expand All @@ -181,7 +194,7 @@ let package = Package(
.target(
name: "PackagePlugin",
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-package-description-version", "999.0"]),
.unsafeFlags(["-enable-library-evolution"]),
],
Expand All @@ -199,7 +212,7 @@ let package = Package(
"SPMBuildCore",
],
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.enableExperimentalFeature("AccessLevelOnImport"),
.unsafeFlags(["-static"]),
]
Expand All @@ -215,7 +228,7 @@ let package = Package(
.product(name: "SystemPackage", package: "swift-system"),
],
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.enableExperimentalFeature("StrictConcurrency"),
.enableExperimentalFeature("AccessLevelOnImport"),
.enableExperimentalFeature("InternalImportsByDefault"),
Expand All @@ -235,7 +248,7 @@ let package = Package(
.product(name: "SystemPackage", package: "swift-system"),
],
exclude: ["CMakeLists.txt", "Vendor/README.md"],
swiftSettings: [
swiftSettings: swift6CompatibleExperimentalFeatures + [
.enableExperimentalFeature("StrictConcurrency"),
.enableExperimentalFeature("AccessLevelOnImport"),
.unsafeFlags(["-static"]),
Expand All @@ -247,7 +260,7 @@ let package = Package(
name: "LLBuildManifest",
dependencies: ["Basics"],
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -263,7 +276,7 @@ let package = Package(
"PackageSigning",
],
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -276,7 +289,7 @@ let package = Package(
"PackageModel",
],
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -286,7 +299,7 @@ let package = Package(
name: "SPMLLBuild",
dependencies: ["Basics"],
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -298,7 +311,7 @@ let package = Package(
name: "PackageModel",
dependencies: ["Basics"],
exclude: ["CMakeLists.txt", "README.md"],
swiftSettings: [
swiftSettings: swift6CompatibleExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -312,7 +325,7 @@ let package = Package(
"PackageModel",
] + swiftSyntaxDependencies(["SwiftBasicFormat", "SwiftDiagnostics", "SwiftIDEUtils", "SwiftParser", "SwiftSyntax", "SwiftSyntaxBuilder"]),
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -326,7 +339,7 @@ let package = Package(
"SourceControl",
],
exclude: ["CMakeLists.txt", "README.md"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -343,7 +356,7 @@ let package = Package(
.product(name: "OrderedCollections", package: "swift-collections"),
],
exclude: ["CMakeLists.txt", "README.md"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -357,7 +370,7 @@ let package = Package(
exclude: [
"Formats/v1.md",
],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -372,7 +385,7 @@ let package = Package(
"PackageModel",
"SourceControl",
],
swiftSettings: [
swiftSettings: swift6CompatibleExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -385,7 +398,7 @@ let package = Package(
"Basics",
"PackageCollectionsModel",
],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -397,7 +410,7 @@ let package = Package(
"PackageModel",
],
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -411,7 +424,7 @@ let package = Package(
"PackageModel",
],
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -427,7 +440,7 @@ let package = Package(
.product(name: "OrderedCollections", package: "swift-collections"),
],
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -445,7 +458,7 @@ let package = Package(
"DriverSupport",
],
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -457,7 +470,7 @@ let package = Package(
.product(name: "SwiftDriver", package: "swift-driver"),
],
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -470,7 +483,7 @@ let package = Package(
.product(name: "OrderedCollections", package: "swift-collections"),
],
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -480,7 +493,8 @@ let package = Package(
"SPMBuildCore",
"PackageGraph",
],
exclude: ["CMakeLists.txt", "README.md"]
exclude: ["CMakeLists.txt", "README.md"],
swiftSettings: commonExperimentalFeatures
),
.target(
/** High level functionality */
Expand All @@ -497,7 +511,7 @@ let package = Package(
.product(name: "OrderedCollections", package: "swift-collections"),
],
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -511,7 +525,7 @@ let package = Package(
"PackageRegistry",
"PackageSigning",
],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -533,7 +547,7 @@ let package = Package(
"SwiftBuildSupport",
],
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -555,7 +569,7 @@ let package = Package(
"SwiftBuildSupport",
] + swiftSyntaxDependencies(["SwiftIDEUtils"]),
exclude: ["CMakeLists.txt", "README.md"],
swiftSettings: [
swiftSettings: swift6CompatibleExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -571,7 +585,7 @@ let package = Package(
"PackageModel",
],
exclude: ["CMakeLists.txt", "README.md"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -587,7 +601,7 @@ let package = Package(
"PackageCollections",
"PackageModel",
],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand All @@ -609,7 +623,7 @@ let package = Package(
"SPMBuildCore",
"Workspace",
],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
Expand Down Expand Up @@ -717,7 +731,7 @@ let package = Package(
name: "CompilerPluginSupport",
dependencies: ["PackageDescription"],
exclude: ["CMakeLists.txt"],
swiftSettings: [
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-package-description-version", "999.0"]),
.unsafeFlags(["-enable-library-evolution"]),
]
Expand Down Expand Up @@ -842,7 +856,8 @@ let package = Package(
),
.testTarget(
name: "PackageGraphTests",
dependencies: ["PackageGraph", "_InternalTestSupport"]
dependencies: ["PackageGraph", "_InternalTestSupport"],
swiftSettings: commonExperimentalFeatures
),
.testTarget(
name: "PackageGraphPerformanceTests",
Expand Down
1 change: 1 addition & 0 deletions Sources/Basics/AuthorizationProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//
//===----------------------------------------------------------------------===//

import TSCBasic
import struct Foundation.Data
import struct Foundation.Date
import struct Foundation.URL
Expand Down
2 changes: 2 additions & 0 deletions Sources/Basics/Collections/Dictionary+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
//
//===----------------------------------------------------------------------===//

import TSCBasic

extension Dictionary {
@inlinable
@discardableResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//

import _Concurrency
import TSCUtility

/// A progress animation wrapper that throttles updates to a given interval.
final class ThrottledProgressAnimation: ProgressAnimationProtocol {
Expand Down
1 change: 1 addition & 0 deletions Sources/Basics/SQLite.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//
//===----------------------------------------------------------------------===//

import TSCBasic
import Foundation

#if SWIFT_PACKAGE && (os(Windows) || os(Android))
Expand Down
1 change: 1 addition & 0 deletions Sources/Basics/Triple+Basics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//
//===----------------------------------------------------------------------===//

import TSCUtility
import enum TSCBasic.JSON

extension Triple {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import PackageModel

import OrderedCollections
import SPMBuildCore
import TSCUtility

import struct TSCBasic.SortedArray

Expand Down Expand Up @@ -434,7 +435,7 @@ extension SortedArray where Element == AbsolutePath {
}
}

extension Triple {
extension Basics.Triple {
var supportsFrameworks: Bool {
return self.isDarwin()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Basics
import Foundation
import PackageGraph
import PackageLoading
import TSCUtility

@_spi(SwiftPMInternal)
import PackageModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import struct Basics.InternalError
import class Basics.ObservabilityScope
import struct PackageGraph.ResolvedModule
import PackageModel
import SPMBuildCore

extension LLBuildManifestBuilder {
/// Create a llbuild target for a Clang target description.
Expand Down
Loading