Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit
Swift apple-silicond3dmetaldxmtdxvkgame-porting-toolkitgptkmac-gamingmacosmetalfxrosetta-2steamsteam-playwinewinecx
feat(versioning): order Steam installs by build, so the semver can go back to 0.x
raymondchinsda92f690c8ed
diff --git a/app/Sources/BridgeplayApp/Resources/Localization/Localizable.xcstrings b/app/Sources/BridgeplayApp/Resources/Localization/Localizable.xcstringsindex 4bea1ff..96b7f53 100644--- a/app/Sources/BridgeplayApp/Resources/Localization/Localizable.xcstrings+++ b/app/Sources/BridgeplayApp/Resources/Localization/Localizable.xcstrings@@ -10187,6 +10187,22 @@}}},+ "build %lld" : {+ "localizations" : {+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "build %lld"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "版本 %lld"+ }+ }+ }+ },"declares a second bundle. One is the most that can be installed." : {"localizations" : {"it" : {diff --git a/app/Sources/BridgeplayApp/Support/InstallIntoSteamCommand.swift b/app/Sources/BridgeplayApp/Support/InstallIntoSteamCommand.swiftindex 811d601..36c4fa7 100644--- a/app/Sources/BridgeplayApp/Support/InstallIntoSteamCommand.swift+++ b/app/Sources/BridgeplayApp/Support/InstallIntoSteamCommand.swift@@ -34,7 +34,7 @@ enum InstallIntoSteamCommand {_ = try await ValveFetcher.run { say($0.label) }}try SteamInstaller.finish(result)- say("Bridgeplay \(result.version) installed into Steam.")+ say("Bridgeplay \(ProductVersion.short) installed into Steam.")return 0} catch {AppLog.note("command line failed: \(RemoveEverythingCommand.failureMessage(error))")diff --git a/app/Sources/BridgeplayApp/Support/ProductVersion.swift b/app/Sources/BridgeplayApp/Support/ProductVersion.swiftindex a79e5b9..23541cb 100644--- a/app/Sources/BridgeplayApp/Support/ProductVersion.swift+++ b/app/Sources/BridgeplayApp/Support/ProductVersion.swift@@ -7,7 +7,7 @@ enum ProductVersion {// CFBundleShortVersionString: Bridgeplay semver, the same string recorded as the// installed build in Steam.- static var short: String { AppVersion.bundled }+ static var short: String { AppVersion.display }// CFBundleVersion: the release counter Sparkle orders updates by.static var build: String? { stamped(Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion")) }diff --git a/app/Sources/BridgeplayApp/SystemStatus.swift b/app/Sources/BridgeplayApp/SystemStatus.swiftindex b5e4fbb..748fd70 100644--- a/app/Sources/BridgeplayApp/SystemStatus.swift+++ b/app/Sources/BridgeplayApp/SystemStatus.swift@@ -8,9 +8,25 @@ import UniformTypeIdentifiersenum AppVersion {static let fallback = "0.1.0-dev"- static var bundled: String {+ // The semver people see. It went from 3.5.0 back to 0.7.0, so it doesn't order installs.+ static var display: String {Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? fallback}++ // What Steam's install records carry and compare (dylib.version, the build record).+ static var bundled: String { deployKey(build: ProductVersion.build, display: display) }++ // "4.0.<build>": the build counter only goes up, and 4 sorts past every 3.x record, so an+ // older app another macOS user still runs sees a newer install and leaves it alone.+ static func deployKey(build: String?, display: String) -> String {+ build.map { "4.0.\($0)" } ?? display+ }++ // A deploy key as people read it: "4.0.44" is "build 44"; older records are versions.+ static func label(deployed: String) -> String {+ guard deployed.hasPrefix("4.0."), let build = Int(deployed.dropFirst(4)) else { return deployed }+ return String(localized: "build \(build)")+ }}struct StatusSnapshot: Sendable {diff --git a/app/Sources/BridgeplayApp/Views/StatusView.swift b/app/Sources/BridgeplayApp/Views/StatusView.swiftindex d3c6822..885860f 100644--- a/app/Sources/BridgeplayApp/Views/StatusView.swift+++ b/app/Sources/BridgeplayApp/Views/StatusView.swift@@ -587,7 +587,7 @@ struct StatusView: View {if payload.isSteamComplete {StatusRow(title: "Bridgeplay",- value: String(localized: "Installed") + (version.map { " (\($0))" } ?? ""),+ value: String(localized: "Installed") + (version.map { " (\(AppVersion.label(deployed: $0)))" } ?? ""),tone: .ok)} else {@@ -599,10 +599,10 @@ struct StatusView: View {action: installAction(prominent: true))}- case .outdated(_, let bundled):+ case .outdated:StatusRow(title: "Bridgeplay",- value: String(localized: "Update available (\(bundled))."),+ value: String(localized: "Update available (\(ProductVersion.short))."),tone: .warning,action: installAction(prominent: true))diff --git a/app/Tests/BridgeplayAppTests/VersioningTests.swift b/app/Tests/BridgeplayAppTests/VersioningTests.swiftindex 39dea5f..23aaf21 100644--- a/app/Tests/BridgeplayAppTests/VersioningTests.swift+++ b/app/Tests/BridgeplayAppTests/VersioningTests.swift@@ -18,14 +18,33 @@ struct ProductVersionTests {// The last version of the old scheme, as an installed build record in Steam says it.private static let lastLegacy = "1.2.0-winehq.1-ray.32"- @Test("The Bridgeplay version reads as newer than any build of the old scheme")+ @Test("The install record reads as newer than any build of the old scheme")func newerThanLegacy() throws {let version = try Self.define("BRIDGEPLAY_VERSION")#expect(version.split(separator: ".").count == 3)- let bundled = DeploymentContent.Build(version: version, builtAt: 1)- let installed = DeploymentContent.Build(version: Self.lastLegacy, builtAt: 2)- #expect(bundled.isNewer(than: installed))- #expect(!installed.isNewer(than: bundled))+ let key = AppVersion.deployKey(build: try Self.define("BRIDGEPLAY_BUILD"), display: version)+ let bundled = DeploymentContent.Build(version: key, builtAt: 1)+ for old in [Self.lastLegacy, "3.5.0"] {+ let installed = DeploymentContent.Build(version: old, builtAt: 2)+ #expect(bundled.isNewer(than: installed), "\(old)")+ #expect(!installed.isNewer(than: bundled), "\(old)")+ }+ }++ // 3.5.0 went back to 0.7.0: installs are ordered by the build, never the display version.+ @Test("The deploy key follows the build, and an older app leaves a newer install alone")+ func deployKey() {+ #expect(AppVersion.deployKey(build: "44", display: "0.7.0") == "4.0.44")+ #expect(AppVersion.deployKey(build: nil, display: "0.1.0-dev") == "0.1.0-dev")+ let next = DeploymentContent.Build(version: AppVersion.deployKey(build: "45", display: "0.7.1"), builtAt: 1)+ let this = DeploymentContent.Build(version: AppVersion.deployKey(build: "44", display: "0.7.0"), builtAt: 2)+ let build100 = DeploymentContent.Build(version: AppVersion.deployKey(build: "100", display: "0.9.0"), builtAt: 1)+ #expect(next.isNewer(than: this) && build100.isNewer(than: next))+ // Bridgeplay 3.5.0 (build 43), as another macOS user sharing Steam.app might still run it.+ let older = DeploymentContent.Build(version: "3.5.0", builtAt: 3)+ #expect(this.isNewer(than: older) && !older.isNewer(than: this))+ #expect(AppVersion.label(deployed: "4.0.44") == "build 44")+ #expect(AppVersion.label(deployed: "3.5.0") == "3.5.0")}@Test("The build number is a plain integer past the old ray counter")diff --git a/docs/RELEASING.md b/docs/RELEASING.mdindex 85d2c1e..ea0b9de 100644--- a/docs/RELEASING.md+++ b/docs/RELEASING.md@@ -19,7 +19,7 @@ bump differs), skips them;| Define | Meaning | In the app | In the appcast ||---|---|---|---|-| `BRIDGEPLAY_VERSION` | Bridgeplay semver, kept slow: patch for every normal release (fixes, features, upstream NotProton merges), so 3.5.12 is fine. Minor only for a milestone chosen on purpose (a new engine or backend, a big redesign). Major only for breaks (prefix, save or install layout). Bundle changes into one release rather than releasing per merge | `CFBundleShortVersionString`, About, Status | `sparkle:shortVersionString`, tag `v<version>` |+| `BRIDGEPLAY_VERSION` | Bridgeplay semver, kept slow (it went from 3.5.0 back to 0.7.0 in build 44, so it never orders installs): patch for every normal release (fixes, features, upstream NotProton merges), so 3.5.12 is fine. Minor only for a milestone chosen on purpose (a new engine or backend, a big redesign). Major only for breaks (prefix, save or install layout). Bundle changes into one release rather than releasing per merge | `CFBundleShortVersionString`, About, Status | `sparkle:shortVersionString`, tag `v<version>` || `BRIDGEPLAY_BUILD` | +1 on every release; Sparkle orders updates by it | `CFBundleVersion` | `sparkle:version` || `NOTPROTON_VERSION` | the upstream release this is based on, exactly as upstream ships it | `NotProtonVersion`, About ("based on NotProton 1.2.0") | release notes |@@ -33,10 +33,11 @@ every NotProton-WineHQ build:| next fix | — | `2.0.1`, build `33` || next upstream merge | — | `2.1.0`, build `34` |-Sparkle compares `32` with `1.1.9.31` part by part, so `32 > 1` makes it newer. The semver-starts at 2.0.0 because the app compares the build recorded in Steam numerically-(`DeploymentContent`): a 1.0.0 would read as older than the installed 1.2.0-… and block-installation. `VersioningTests` guards both.+Sparkle compares `32` with `1.1.9.31` part by part, so `32 > 1` makes it newer. The app+compares the build recorded in Steam numerically (`DeploymentContent`), so since 0.7.0 that+record holds `4.0.<build>` (`AppVersion.deployKey`), not the semver: it sorts past every+older record (`1.2.0-…`, `3.5.0`), and an older app that another macOS user still runs sees+a newer install and leaves it alone. `VersioningTests` guards both.## Steps