|
13 | 13 | import ArgumentParser
|
14 | 14 | import Basics
|
15 | 15 | import Build
|
| 16 | +import CoreCommands |
16 | 17 | import PackageGraph
|
17 | 18 | import SPMBuildCore
|
18 | 19 | import TSCBasic
|
| 20 | +import XCBuildSupport |
19 | 21 |
|
20 | 22 | import enum TSCUtility.Diagnostics
|
21 | 23 | import func TSCUtility.getClangVersion
|
@@ -94,7 +96,7 @@ public struct SwiftBuildTool: SwiftCommand {
|
94 | 96 | helpNames: [.short, .long, .customLong("help", withSingleDash: true)])
|
95 | 97 |
|
96 | 98 | @OptionGroup()
|
97 |
| - var globalOptions: GlobalOptions |
| 99 | + public var globalOptions: GlobalOptions |
98 | 100 |
|
99 | 101 | @OptionGroup()
|
100 | 102 | var options: BuildToolOptions
|
@@ -157,8 +159,22 @@ public struct SwiftBuildTool: SwiftCommand {
|
157 | 159 | public init() {}
|
158 | 160 | }
|
159 | 161 |
|
160 |
| -extension Basics.Diagnostic { |
161 |
| - static func mutuallyExclusiveArgumentsError(arguments: [String]) -> Self { |
162 |
| - .error(arguments.map{ "'\($0)'" }.spm_localizedJoin(type: .conjunction) + " are mutually exclusive") |
| 162 | +extension SwiftCommand { |
| 163 | + public func buildSystemProvider(_ swiftTool: SwiftTool) throws -> BuildSystemProvider { |
| 164 | + return .init(providers: try swiftTool.defaultBuildSystemProvider.providers.merging([ |
| 165 | + .xcode: { (explicitProduct: String?, cacheBuildManifest: Bool, customBuildParameters: BuildParameters?, customPackageGraphLoader: (() throws -> PackageGraph)?, customOutputStream: OutputByteStream?, customLogLevel: Basics.Diagnostic.Severity?, customObservabilityScope: ObservabilityScope?) throws -> BuildSystem in |
| 166 | + let graphLoader = { try swiftTool.loadPackageGraph(explicitProduct: explicitProduct) } |
| 167 | + return try XcodeBuildSystem( |
| 168 | + buildParameters: customBuildParameters ?? swiftTool.buildParameters(), |
| 169 | + packageGraphLoader: customPackageGraphLoader ?? graphLoader, |
| 170 | + outputStream: customOutputStream ?? swiftTool.outputStream, |
| 171 | + logLevel: customLogLevel ?? swiftTool.logLevel, |
| 172 | + fileSystem: swiftTool.fileSystem, |
| 173 | + observabilityScope: customObservabilityScope ?? swiftTool.observabilityScope |
| 174 | + ) |
| 175 | + }, |
| 176 | + ], uniquingKeysWith: { a, b in |
| 177 | + return b |
| 178 | + })) |
163 | 179 | }
|
164 | 180 | }
|
0 commit comments