xtool.git
Publicgit clone https://git.maproj.org/xtool.gitxtool.git / Sources / XToolSupport / DevBSPCommand.swift
DevBSPCommand.swift34 lines · 934 BRaw
| 1 | import XCLIUtils |
| 2 | import XUtils |
| 3 | import ArgumentParser |
| 4 | import Foundation |
| 5 | import XKit |
| 6 | import PackLib |
| 7 | import Subprocess |
| 8 | |
| 9 | struct DevBSPCommand: AsyncParsableCommand { |
| 10 | static let configuration = CommandConfiguration( |
| 11 | commandName: "build-server", |
| 12 | abstract: "Run build server", |
| 13 | ) |
| 14 | |
| 15 | @Option |
| 16 | var triple: String? |
| 17 | |
| 18 | func run() async throws { |
| 19 | guard try await SwiftVersion.current.supportsSwiftBuild else { |
| 20 | throw Console.Error("`xtool dev build-server` requires Swift 6.4 or later") |
| 21 | } |
| 22 | let settings = try await BuildSettings( |
| 23 | configuration: .debug, |
| 24 | triple: triple ?? PackOperation.defaultTriple |
| 25 | ) |
| 26 | try await Subprocess.run( |
| 27 | settings.buildServerInvocation(), |
| 28 | input: .currentStandardInput, |
| 29 | output: .currentStandardOutput, |
| 30 | error: .currentStandardError, |
| 31 | ) |
| 32 | .checkSuccess() |
| 33 | } |
| 34 | } |