Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.
Swift apple-silicond3dmetaldxmtdxvkfexgame-porting-toolkitgamingmac-gamingmacosmetalmoltenvksteamswiftuivkd3d-protonwhisky-alternativewindows-gameswinewine-wrapper
a step blocked by Xcode's licence says so, instead of quoting the wrong line
Gauthier Piarrette4b4b1c05394b
diff --git a/Sources/HighballKit/Recovery.swift b/Sources/HighballKit/Recovery.swiftindex eecdb24..8f8dd46 100644--- a/Sources/HighballKit/Recovery.swift+++ b/Sources/HighballKit/Recovery.swift@@ -59,6 +59,16 @@ public struct Recovery: Equatable, Sendable {return Recovery(headline: "The download didn't arrive intact.",meaning: "This is usually a network problem. Highball discards the damaged file and downloads it again.",actionTitle: "Download again", action: .retry)+ // Before any other failed command, because this one is the environment rather than the+ // step: while the licence sits unaccepted, macOS refuses every Xcode-provided tool, and+ // winetricks' own closing line then names something unrelated ("wine cmd.exe ... returned+ // empty string"). highball#180 spent three rounds looking at downloads and SourceForge+ // before the reporter found it themselves. Retry is still the right button, because it is+ // the right one once they have accepted.+ case let .processFailed(_, _, output) where Self.xcodeLicenceUnaccepted(output):+ return Recovery(headline: "Xcode's licence has not been accepted on this Mac.",+ meaning: "Until it is, the developer tools this step needs refuse to run, so it stops partway and says something unrelated. Open Terminal, run sudo xcodebuild -license, read it through and accept it, then try again here.",+ actionTitle: "Try again", action: .retry)case let .processFailed(command, _, _) where command.hasPrefix("wineboot"):return Recovery(headline: "The Windows environment didn't finish setting up.",meaning: "Highball can run the setup again.",@@ -98,6 +108,14 @@ public struct Recovery: Equatable, Sendable {extension Recovery {+ /// macOS refuses every Xcode-provided command line tool until the licence has been accepted,+ /// and prints this one sentence when it does. It can land anywhere in a step's output rather+ /// than at the end, so it is matched across the whole of it: in highball#180 it appeared four+ /// times in the middle of a corefonts run whose last real line was about `%AppData%`.+ static func xcodeLicenceUnaccepted(_ output: String) -> Bool {+ output.contains("You have not agreed to the Xcode license agreements")+ }+/// The last line of a winetricks run that says something, skipping its progress noise and/// the shell's own "exited with" footer. Nil when the output is empty.static func winetricksReason(_ output: String) -> String? {diff --git a/Tests/HighballKitTests/RegressionTests.swift b/Tests/HighballKitTests/RegressionTests.swiftindex ed63d7e..30d2465 100644--- a/Tests/HighballKitTests/RegressionTests.swift+++ b/Tests/HighballKitTests/RegressionTests.swift@@ -1146,6 +1146,29 @@ extension RegressionTests {let said = Recovery.describe(HighballError.processFailed(command: "/bin/bash /e/tools/winetricks --unattended corefonts", status: 1, output: out))XCTAssertTrue(said.meaning.hasSuffix("It said: warning: /usr/bin/curl failed to download arial32.exe: SourceForge returned 503"), said.meaning)XCTAssertNil(Recovery.winetricksReason("Executing x\n------\n"), "noise-only output gives no reason")+ // highball#180, the reporter's own output. The licence sentence sits four lines up from+ // the end, so the generic path would have quoted the %AppData% warning and sent them back+ // to the network for a fourth round. Name the cause instead.+ let xcode = """+ warning: taskset/cpuset not available on your platform!+ You have not agreed to the Xcode license agreements. Please run 'sudo xcodebuild -license' from within a Terminal window to review and agree to the Xcode and Apple SDKs license.+ You have not agreed to the Xcode license agreements. Please run 'sudo xcodebuild -license' from within a Terminal window to review and agree to the Xcode and Apple SDKs license.+ ------------------------------------------------------+ warning: /e/engine/bin/wine cmd.exe /c echo '%AppData%' returned empty string, error message ""+ ------------------------------------------------------+ """+ let licence = Recovery.describe(HighballError.processFailed(command: "/bin/bash /e/tools/winetricks --unattended corefonts", status: 1, output: xcode))+ XCTAssertTrue(licence.headline.contains("Xcode's licence"), licence.headline)+ XCTAssertTrue(licence.meaning.contains("sudo xcodebuild -license"), licence.meaning)+ XCTAssertFalse(licence.meaning.contains("%AppData%"), "the unrelated last line must not be quoted as the reason")+ XCTAssertFalse(licence.meaning.contains("It said"), "the cause is named, not quoted from the tail")+ XCTAssertEqual(licence.action, .retry, "retry is right once they have accepted")+ // It reaches any failed command, not just winetricks: the licence blocks every Xcode tool,+ // and "Repair" would be the wrong button to offer for it.+ let bootLicence = Recovery.describe(HighballError.processFailed(command: "wineboot -u", status: 1, output: xcode))+ XCTAssertTrue(bootLicence.headline.contains("Xcode's licence"), bootLicence.headline)+ XCTAssertNotEqual(bootLicence.action, .repairBottle)+ XCTAssertFalse(Recovery.xcodeLicenceUnaccepted("warning: curl failed\n"), "unrelated output is not the licence gate")let wow = Recovery.describe(HighballError.invalid("Windows 32-bit support couldn't be set up in this bottle"))XCTAssertEqual(wow.action, .repairBottle)let net = Recovery.describe(URLError(.timedOut))