Skip to content

Commit 0506bb2

Browse files
committed
Enforce a minimum Xcode version for Open Source testing workflows
This provides a user-visible error message when attempting to initialize a Core with an older version, and removes the explicit version listing from the README so it doesn't need to be updated in multiple places.
1 parent 0d89241 commit 0506bb2

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ When building SwiftPM from sources which include Swift Build integration, passin
1212

1313
### With Xcode
1414

15-
Changes to swift-build can also be tested in Xcode using the `launch-xcode` command plugin provided by the package. Run `swift package --disable-sandbox launch-xcode` from your checkout of swift-build to launch a copy of the currently `xcode-select`ed Xcode.app configured to use your modified copy of the build system service. This workflow is currently supported when using Xcode 16.2.
15+
Changes to swift-build can also be tested in Xcode using the `launch-xcode` command plugin provided by the package. Run `swift package --disable-sandbox launch-xcode` from your checkout of swift-build to launch a copy of the currently `xcode-select`ed Xcode.app configured to use your modified copy of the build system service. This workflow is generally only supported when using the latest available Xcode version.
1616

1717
### With xcodebuild
1818

19-
Changes to swift-build can also be tested in xcodebuild using the `run-xcodebuild` command plugin provided by the package. Run `swift package --disable-sandbox run-xcodebuild` from your checkout of swift-build to run xcodebuild from the currently `xcode-select`ed Xcode.app configured to use your modified copy of the build system service. Arguments followed by `--` will be forwarded to xcodebuild unmodified. This workflow is currently supported when using Xcode 16.2.
19+
Changes to swift-build can also be tested in xcodebuild using the `run-xcodebuild` command plugin provided by the package. Run `swift package --disable-sandbox run-xcodebuild` from your checkout of swift-build to run xcodebuild from the currently `xcode-select`ed Xcode.app configured to use your modified copy of the build system service. Arguments followed by `--` will be forwarded to xcodebuild unmodified. This workflow is generally only supported when using the latest available Xcode version.
2020

2121
### Debugging
2222

Sources/SWBCore/Core.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,12 @@ public final class Core: Sendable {
245245
// If the ProductBuildVersion key is missing, we use "UNKNOWN" as the value.
246246
self.xcodeProductBuildVersion = info.productBuildVersion ?? ProductBuildVersion(major: 0, train: "A", build: 0, buildSuffix: "")
247247
self.xcodeProductBuildVersionString = info.productBuildVersion?.description ?? "UNKNOWN"
248+
249+
// Enforce a minimum Xcode version for Open Source testing workflows
250+
let minimumXcodeVersion = Version(16, 2)
251+
if xcodeVersion < minimumXcodeVersion {
252+
throw StubError.error("This build of Swift Build requires a minimum Xcode version of \(minimumXcodeVersion.description) (current version: \(xcodeVersion.zeroTrimmed.description)).")
253+
}
248254
} else {
249255
// Set an arbitrary version for testing purposes.
250256
self.xcodeVersion = Version(99, 99, 99)

0 commit comments

Comments
 (0)