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