Skip to content

Commit 691f931

Browse files
authored
Revert "Remove --enable-swift-testing _et al._ from swift build. … (#7790)
…(#7784)"
1 parent de9cf32 commit 691f931

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Sources/Commands/SwiftBuildCommand.swift

+15
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,21 @@ struct BuildCommandOptions: ParsableArguments {
104104
/// If should link the Swift stdlib statically.
105105
@Flag(name: .customLong("static-swift-stdlib"), inversion: .prefixedNo, help: "Link Swift stdlib statically")
106106
public var shouldLinkStaticSwiftStdlib: Bool = false
107+
108+
/// Which testing libraries to use (and any related options.)
109+
@OptionGroup()
110+
var testLibraryOptions: TestLibraryOptions
111+
112+
func validate() throws {
113+
// If --build-tests was not specified, it does not make sense to enable
114+
// or disable either testing library.
115+
if !buildTests {
116+
if testLibraryOptions.explicitlyEnableXCTestSupport != nil
117+
|| testLibraryOptions.explicitlyEnableSwiftTestingLibrarySupport != nil {
118+
throw StringError("pass --build-tests to build test targets")
119+
}
120+
}
121+
}
107122
}
108123

109124
/// swift-build command namespace

0 commit comments

Comments
 (0)