-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Update Package.swift dependency #8802
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@swift-ci test |
jakepetroules
approved these changes
Jun 11, 2025
jakepetroules
requested changes
Jun 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, actually it looks like we need to conditionalize the TSC dependency in _InternalTestSupport as well.
Try these changes as well:
diff --git a/Package.swift b/Package.swift
--- a/Package.swift
+++ b/Package.swift
@@ -100,33 +100,38 @@
automatic linking type with `-auto` suffix appended to product's name.
*/
let autoProducts = [swiftPMProduct, swiftPMDataModelProduct]
let shoudUseSwiftBuildFramework = (ProcessInfo.processInfo.environment["SWIFTPM_SWBUILD_FRAMEWORK"] != nil)
let swiftDriverDeps: [Target.Dependency]
let swiftTSCBasicsDeps: [Target.Dependency]
let swiftToolsCoreSupportAutoDeps: [Target.Dependency]
+let swiftTSCTestSupportDeps: [Target.Dependency]
if shoudUseSwiftBuildFramework {
swiftDriverDeps = []
swiftTSCBasicsDeps = []
swiftToolsCoreSupportAutoDeps = []
+ swiftTSCTestSupportDeps = []
} else {
swiftDriverDeps = [
.product(name: "SwiftDriver", package: "swift-driver")
]
swiftTSCBasicsDeps = [
.product(name: "TSCBasic", package: "swift-tools-support-core"),
]
swiftToolsCoreSupportAutoDeps = [
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core")
]
+ swiftTSCTestSupportDeps = [
+ .product(name: "TSCTestSupport", package: "swift-tools-support-core"),
+ ]
}
let package = Package(
name: "SwiftPM",
platforms: [
.macOS(.v13),
.iOS(.v17),
.macCatalyst(.v17),
],
products:
@@ -338,20 +343,19 @@
.unsafeFlags(["-static"]),
]
),
.target(
/** API for inspecting symbols defined in binaries */
name: "BinarySymbols",
dependencies: [
"Basics",
- .product(name: "TSCBasic", package: "swift-tools-support-core"),
- ],
+ ] + swiftTSCBasicsDeps,
exclude: ["CMakeLists.txt"],
swiftSettings: commonExperimentalFeatures + [
.unsafeFlags(["-static"]),
]
),
// MARK: Project Model
.target(
@@ -813,22 +817,21 @@
name: "_InternalTestSupport",
dependencies: [
"Basics",
"PackageFingerprint",
"PackageGraph",
"PackageLoading",
"PackageRegistry",
"PackageSigning",
"SourceControl",
- .product(name: "TSCTestSupport", package: "swift-tools-support-core"),
.product(name: "OrderedCollections", package: "swift-collections"),
"Workspace",
- ],
+ ] + swiftTSCTestSupportDeps,
swiftSettings: [
.unsafeFlags(["-static"]),
]
),
.target(
/** Test for thread-sanitizer. */
name: "tsan_utils",
dependencies: [],
@@ -1090,45 +1093,53 @@
]
}
package.targets.first(where: { $0.name == "SPMLLBuild" })!.dependencies += [
.product(name: "llbuildSwift", package: "swift-llbuild"),
]
}
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
package.dependencies += [
- .package(url: "https://github.com/swiftlang/swift-tools-support-core.git", branch: relatedDependenciesBranch),
// The 'swift-argument-parser' version declared here must match that
// used by 'swift-driver' and 'sourcekit-lsp'. Please coordinate
// dependency version changes here with those projects.
.package(url: "https://github.com/apple/swift-argument-parser.git", .upToNextMinor(from: "1.4.0")),
- .package(url: "https://github.com/swiftlang/swift-driver.git", branch: relatedDependenciesBranch),
.package(url: "https://github.com/apple/swift-crypto.git", .upToNextMinor(from: "3.0.0")),
.package(url: "https://github.com/swiftlang/swift-syntax.git", branch: relatedDependenciesBranch),
.package(url: "https://github.com/apple/swift-system.git", from: "1.1.1"),
.package(url: "https://github.com/apple/swift-collections.git", "1.0.1" ..< "1.2.0"),
.package(url: "https://github.com/apple/swift-certificates.git", "1.0.1" ..< "1.6.0"),
.package(url: "https://github.com/swiftlang/swift-toolchain-sqlite.git", from: "1.0.0"),
// For use in previewing documentation
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.1.0"),
]
+ if !swiftDriverDeps.isEmpty {
+ package.dependencies += [
+ .package(url: "https://github.com/swiftlang/swift-tools-support-core.git", branch: relatedDependenciesBranch),
+ .package(url: "https://github.com/swiftlang/swift-driver.git", branch: relatedDependenciesBranch),
+ ]
+ }
} else {
package.dependencies += [
- .package(path: "../swift-tools-support-core"),
.package(path: "../swift-argument-parser"),
- .package(path: "../swift-driver"),
.package(path: "../swift-crypto"),
.package(path: "../swift-syntax"),
.package(path: "../swift-system"),
.package(path: "../swift-collections"),
.package(path: "../swift-certificates"),
.package(path: "../swift-toolchain-sqlite"),
]
+ if !swiftDriverDeps.isEmpty {
+ package.dependencies += [
+ .package(path: "../swift-tools-support-core"),
+ .package(path: "../swift-driver"),
+ ]
+ }
}
/// If ENABLE_APPLE_PRODUCT_TYPES is set in the environment, then also define ENABLE_APPLE_PRODUCT_TYPES in each of the regular targets and test targets.
if ProcessInfo.processInfo.environment["ENABLE_APPLE_PRODUCT_TYPES"] == "1" {
for target in package.targets.filter({ $0.type == .regular || $0.type == .test }) {
target.swiftSettings = (target.swiftSettings ?? []) + [ .define("ENABLE_APPLE_PRODUCT_TYPES") ]
}
}
We should avoid adding a dependency on Swift Tools Support Core in SwiftPM. If we need to, we ought to use the `swiftTSCBasicsDeps` and `swiftToolsCoreSupportAutoDeps` variables.
775cbd7
to
e997fab
Compare
@swift-ci test |
@swift-ci test windows |
jakepetroules
approved these changes
Jun 11, 2025
bkhouri
added a commit
that referenced
this pull request
Jul 9, 2025
When the Integration Tests were merged with the Tests (#8223), the `Package.swift` added dependencies on Swift Tools Support Core. However, the declaration did not take into account when the SWIFTPM_SWBUILD_FRAMEWORK environment variable was defined, which was updated in #8442 and #8802. Update the declaration of any Swift Tools Support Core dependencies to use the respective local variables.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We should avoid adding a dependency on Swift Tools Support Core in SwiftPM. If we need to, we ought to use the
swiftTSCBasicsDeps
andswiftToolsCoreSupportAutoDeps
variables.