Play your Steam library's Windows games on a jailbroken PS5.
C++
Name nightly builds and their commit in About
Leonardo Lobatoe914be53806e
diff --git a/CMakeLists.txt b/CMakeLists.txtindex fb6c769..d4d15b8 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -1,16 +1,32 @@cmake_minimum_required(VERSION 3.24)project(PlaydenLauncher VERSION 0.8.0 LANGUAGES C CXX)-set(PLAYDEN_PRERELEASE "" CACHE STRING "Pre-release suffix: empty or beta.N (1-999999)")+set(PLAYDEN_PRERELEASE "" CACHE STRING "Pre-release suffix: empty, beta.N (1-999999) or nightly.YYYYMMDD.N (1-999)")set(PLAYDEN_FULL_VERSION "${PROJECT_VERSION}")if(NOT PLAYDEN_PRERELEASE STREQUAL "")- if(NOT PLAYDEN_PRERELEASE MATCHES "^beta\\.[1-9][0-9]*$" OR- NOT PLAYDEN_PRERELEASE MATCHES "^beta\\.[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]$")- message(FATAL_ERROR "PLAYDEN_PRERELEASE must be empty or beta.N (1-999999)")+ if(NOT PLAYDEN_PRERELEASE MATCHES "^beta\\.[1-9][0-9]?[0-9]?[0-9]?[0-9]?[0-9]?$" AND+ NOT PLAYDEN_PRERELEASE MATCHES "^nightly\\.20[0-9][0-9][01][0-9][0-3][0-9]\\.[1-9][0-9]?[0-9]?$")+ message(FATAL_ERROR "PLAYDEN_PRERELEASE must be empty, beta.N (1-999999) or nightly.YYYYMMDD.N (1-999)")endif()string(APPEND PLAYDEN_FULL_VERSION "-${PLAYDEN_PRERELEASE}")endif()+# The commit the build is made from, for Settings › About. Configure runs again whenever HEAD moves.+set(PLAYDEN_BUILD_COMMIT "")+find_package(Git QUIET)+if(GIT_FOUND)+ execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --short=10 HEAD WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"+ OUTPUT_VARIABLE PLAYDEN_BUILD_COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET RESULT_VARIABLE playden_git_result)+ if(NOT playden_git_result EQUAL 0 OR NOT PLAYDEN_BUILD_COMMIT MATCHES "^[0-9a-f]+$")+ set(PLAYDEN_BUILD_COMMIT "")+ endif()+ execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --path-format=absolute --git-path logs/HEAD+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE playden_head_log OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)+ if(playden_head_log AND EXISTS "${playden_head_log}")+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${playden_head_log}")+ endif()+endif()+option(PLAYDEN_UI_SIMULATION "Package selected PS5 UI with developer simulation fixtures" OFF)option(PLAYDEN_PLATFORM_PS5 "Build a PS5 native title" OFF)set(PLAYDEN_PS5_TITLE_ID "" CACHE STRING "Explicit PS5 title id (required for PS5 packaging)")diff --git a/cmake/SelfUpdate.cmake b/cmake/SelfUpdate.cmakeindex 513b4ed..403cdc8 100644--- a/cmake/SelfUpdate.cmake+++ b/cmake/SelfUpdate.cmake@@ -15,7 +15,8 @@ add_library(playden_self_update STATIC"${CMAKE_SOURCE_DIR}/src/update/update_service.cpp")target_include_directories(playden_self_update PUBLIC "${CMAKE_SOURCE_DIR}/src")target_compile_features(playden_self_update PUBLIC cxx_std_17)-target_compile_definitions(playden_self_update PRIVATE PLAYDEN_VERSION="${PLAYDEN_FULL_VERSION}")+target_compile_definitions(playden_self_update PRIVATE PLAYDEN_VERSION="${PLAYDEN_FULL_VERSION}"+ PLAYDEN_BUILD_COMMIT="${PLAYDEN_BUILD_COMMIT}")target_link_libraries(playden_self_update PUBLIC playden_miniz playden_steam_protocol playden_steam_http Threads::Threads)if(PLAYDEN_PLATFORM_PS5)target_compile_options(playden_self_update PRIVATE -fno-exceptions -fno-rtti)@@ -26,7 +27,8 @@ if(BUILD_TESTING AND NOT PLAYDEN_PLATFORM_PS5)self_update_swap self_update_service)add_executable(${test_name}_test "${CMAKE_SOURCE_DIR}/tests/${test_name}_test.cpp")target_link_libraries(${test_name}_test PRIVATE playden_self_update)- target_compile_definitions(${test_name}_test PRIVATE PLAYDEN_VERSION="${PLAYDEN_FULL_VERSION}")+ target_compile_definitions(${test_name}_test PRIVATE PLAYDEN_VERSION="${PLAYDEN_FULL_VERSION}"+ PLAYDEN_BUILD_COMMIT="${PLAYDEN_BUILD_COMMIT}")add_test(NAME ${test_name} COMMAND ${test_name}_test)endforeach()endif()diff --git a/src/homebrew/controller.cpp b/src/homebrew/controller.cppindex 976b518..35d3e91 100644--- a/src/homebrew/controller.cpp+++ b/src/homebrew/controller.cpp@@ -2296,6 +2296,7 @@ void Controller::TickSelfUpdate() {LiveSelfUpdate live;live.phase = update::UpdatePhaseName(snapshot.phase);live.current = snapshot.current.ToString();+ live.commit = update::BuildCommit();live.available = snapshot.available.ToString();live.notes = snapshot.notes;live.part = snapshot.part;diff --git a/src/homebrew/ps5.cpp b/src/homebrew/ps5.cppindex d0fd1f0..781cfa7 100644--- a/src/homebrew/ps5.cpp+++ b/src/homebrew/ps5.cpp@@ -395,6 +395,7 @@ int main() {playden::update::UpdateConfig update_config;update_config.latest_release_url = "https://api.github.com/repos/leolobato/playden-ps5/releases/latest";update_config.releases_page = "https://github.com/leolobato/playden-ps5/releases";+ update_config.nightly_page = "https://builds.playden.club/";update_config.title_id = PLAYDEN_PS5_TITLE_ID;update_config.installed_root = std::string("/data/homebrew/") + PLAYDEN_PS5_TITLE_ID;update_config.work_root = "/data/playden/self-update";diff --git a/src/homebrew/simulation.cpp b/src/homebrew/simulation.cppindex 193c8c6..888d0d5 100644--- a/src/homebrew/simulation.cpp+++ b/src/homebrew/simulation.cpp@@ -100,6 +100,21 @@ GameId steam_value(const json::Value* value) {}// The profile file names games by Steam app ID (0: none).+// A version as players read it: "0.7.1-beta.1 (Beta)", and a nightly as "0.8.0 (Nightly)" (About names the build).+std::string version_label(const std::string& version) {+ if (const auto nightly = version.find("-nightly."); nightly != std::string::npos)+ return version.substr(0, nightly) + " (Nightly)";+ return version + (version.find("-beta.") != std::string::npos ? " (Beta)" : "");+}++// "Nightly 20261027.2 · d94c0b384d" for a nightly, the commit for any other build.+std::string build_label(const std::string& version, const std::string& commit) {+ const auto nightly = version.find("-nightly.");+ std::string label = nightly == std::string::npos ? std::string() : "Nightly " + version.substr(nightly + 9);+ if (!commit.empty()) label += (label.empty() ? "" : " · ") + commit;+ return label.empty() ? "Unknown" : label;+}+std::string app_text(const GameId& id) { return std::to_string(id.steam_app().value_or(0)); }// The game a row key or action names; invalid (selects nothing) unless it is a canonical key.@@ -1815,7 +1830,7 @@ void Simulation::show_update_prompt() {size + "You can sign in and keep using Playden while it downloads.";open_modal(std::move(prompt));} else if (pending_update_prompt_ == "available" && update.phase == "available") {- ModalEntry prompt{"confirmation", "Playden " + update.available + (update.available.find("-beta.") != std::string::npos ? " (Beta)" : "") + " is available", state_.navigation.focus_key,+ ModalEntry prompt{"confirmation", "Playden " + version_label(update.available) + " is available", state_.navigation.focus_key,{"self-update-install", "ready-later"}, 0, false};prompt.body = (update.notes.empty() ? std::string() : update.notes + "\n\n") + "The download is " +format_bytes(update.download_bytes) +@@ -1903,8 +1918,7 @@ void Simulation::close_game_modals() {void Simulation::open_release_notes(bool after_update) {const auto& update = state_.self_update;ModalEntry notes{"confirmation",- (after_update ? "What's new in Playden " : "Playden ") + update.current +- (update.current.find("-beta.") != std::string::npos ? " (Beta)" : "") ++ (after_update ? "What's new in Playden " : "Playden ") + version_label(update.current) +(after_update ? std::string() : std::string(" release notes")),state_.navigation.focus_key, {"release-notes-ok"}, 0, false};notes.body = (after_update ? "Playden was updated to " + update.current + ".\n\n" : std::string()) +@@ -4679,9 +4693,8 @@ void Simulation::rebuild_view() {else if (action_key == "account-auth") { item.kind = RowKind::Status; item.value = auth_name(state_.account().authentication); item.subtitle = state_.account().error; item.enabled = false; }else if (action_key == "account-last-sync") { item.kind = RowKind::Status; item.value = state_.account().last_sync == 0 ? "Never" : std::to_string(state_.account().last_sync); item.enabled = false; }else if (action_key.rfind("open-game:", 0) == 0) item.title = "Open game";- else if (action_key == "about-version") { item.kind = RowKind::Status; item.value = live() ? "Playden " + state_.self_update.current +- (state_.self_update.current.find("-beta.") != std::string::npos ? " (Beta)" : "") : "Simulated"; item.enabled = false; }- else if (action_key == "about-build") { item.kind = RowKind::Status; item.value = live() ? "Live service model" : "UI comparison fixture"; item.enabled = false; }+ else if (action_key == "about-version") { item.kind = RowKind::Status; item.value = live() ? "Playden " + version_label(state_.self_update.current) : "Simulated"; item.enabled = false; }+ else if (action_key == "about-build") { item.kind = RowKind::Status; item.value = live() ? build_label(state_.self_update.current, state_.self_update.commit) : "UI comparison fixture"; item.enabled = false; }else if (action_key == "about-framework") { item.kind = RowKind::Status; item.value = "Homebrew native model + Hui"; item.enabled = false; }else if (action_key == "about-platform") { item.kind = RowKind::Status; item.value = "Host / PS5 homebrew"; item.enabled = false; }else if (action_key == "about-kit" || action_key == "about-kit-source") {@@ -5587,7 +5600,7 @@ void Simulation::rebuild_view() {}if (live() && !state_.self_update.current_notes_url.empty()) {auto& notes = add("settings-release-notes", RowKind::Action, "Release notes", "self-update-notes");- notes.subtitle = "What changed in Playden " + state_.self_update.current;+ notes.subtitle = "What changed in Playden " + version_label(state_.self_update.current);}section = "About";add("settings-about", RowKind::Action, "About", "about").subtitle = "Playden for PlayStation 5";diff --git a/src/homebrew/simulation.hpp b/src/homebrew/simulation.hppindex 48f333e..36d4548 100644--- a/src/homebrew/simulation.hpp+++ b/src/homebrew/simulation.hpp@@ -123,6 +123,7 @@ struct LiveKitInfo {struct LiveSelfUpdate {std::string phase = "idle"; // idle, checking, up-to-date, available, downloading, unpacking, staged, failedstd::string current; // "0.2.0"+ std::string commit; // the commit this build was made from, when knownstd::string available; // the newer version, when knownstd::string notes;std::string part; // "kit" or "app" while downloading or unpackingdiff --git a/src/update/release.cpp b/src/update/release.cppindex d298260..f7d0d8d 100644--- a/src/update/release.cpp+++ b/src/update/release.cpp@@ -109,8 +109,9 @@ std::optional<Release> ReleaseFrom(const Json* doc, std::string* error) {Release release;const auto* tag = Text(*doc, "tag_name");const auto version = tag ? ParseVersion(*tag) : std::nullopt;- if (!version) {- if (error) *error = "release tag is not a version";+ // Nightly builds are published elsewhere and are never offered as updates.+ if (!version || version->nightly()) {+ if (error) *error = "release tag is not a release version";return std::nullopt;}release.tag = *tag;@@ -208,6 +209,7 @@ std::optional<UpdateManifest> ParseUpdateManifest(std::string_view json, std::st!app_prefix)return refuse("update manifest app part is incomplete");manifest.app_version = *ParseVersion(*version);+ if (manifest.app_version.nightly()) return refuse("update manifest names a nightly build");manifest.min_from = *ParseVersion(*min_from);manifest.title_id = *title;manifest.app_asset = *app_asset;diff --git a/src/update/update_service.cpp b/src/update/update_service.cppindex 2ff4a6a..8a256b8 100644--- a/src/update/update_service.cpp+++ b/src/update/update_service.cpp@@ -161,7 +161,8 @@ void UpdateService::LoadCurrentNotes() {}}}- if (url.empty()) url = PageFor("v" + config_.current.ToString());+ // A nightly has no release page: its notes are on the page that lists the nightly builds.+ if (url.empty()) url = config_.current.nightly() ? config_.nightly_page : PageFor("v" + config_.current.ToString());Set([&](UpdateSnapshot& s) {s.current_notes = notes;s.current_notes_url = url;diff --git a/src/update/update_service.h b/src/update/update_service.hindex fea2ab0..1310aed 100644--- a/src/update/update_service.h+++ b/src/update/update_service.h@@ -21,6 +21,7 @@ namespace playden::update {struct UpdateConfig {std::string latest_release_url; // https://api.github.com/repos/<owner>/<repo>/releases/lateststd::string releases_page; // https://github.com/<owner>/<repo>/releases (release notes links)+ std::string nightly_page; // where nightly builds and their notes are listedstd::string title_id = "FAKE77031";std::string installed_root; // /data/homebrew/FAKE77031std::string work_root; // /data/playden/self-updatediff --git a/src/update/version.cpp b/src/update/version.cppindex f8fbbd2..02ff5d0 100644--- a/src/update/version.cpp+++ b/src/update/version.cpp@@ -3,14 +3,33 @@#ifndef PLAYDEN_VERSION#error "PLAYDEN_VERSION must be defined by the build"#endif+#ifndef PLAYDEN_BUILD_COMMIT+#define PLAYDEN_BUILD_COMMIT ""+#endifnamespace playden::update {std::string Version::ToString() const {return std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(patch) +- (beta ? "-beta." + std::to_string(beta) : "");+ (beta ? "-beta." + std::to_string(beta) : "") ++ (nightly() ? "-nightly." + std::to_string(nightly_date) + "." + std::to_string(nightly_build) : "");+}++namespace {++// Digits only, no leading zero, at most `max_digits` long.+bool ParseCount(std::string_view text, std::size_t max_digits, unsigned* value) {+ if (text.empty() || text.size() > max_digits || text.front() == '0') return false;+ *value = 0;+ for (const char c : text) {+ if (c < '0' || c > '9') return false;+ *value = *value * 10 + static_cast<unsigned>(c - '0');+ }+ return true;}+} // namespace+std::optional<Version> ParseVersion(std::string_view text) {if (!text.empty() && (text.front() == 'v' || text.front() == 'V')) text.remove_prefix(1);unsigned parts[3] = {};@@ -29,17 +48,22 @@ std::optional<Version> ParseVersion(std::string_view text) {text.remove_prefix(1);}}- unsigned beta = 0;- if (!text.empty()) {- if (text.substr(0, 6) != "-beta.") return std::nullopt;- text.remove_prefix(6);- if (text.empty() || text.size() > 6 || text.front() == '0') return std::nullopt;- for (const char c : text) {- if (c < '0' || c > '9') return std::nullopt;- beta = beta * 10 + static_cast<unsigned>(c - '0');- }+ Version version{parts[0], parts[1], parts[2]};+ if (text.empty()) return version;+ if (text.substr(0, 6) == "-beta.") {+ if (!ParseCount(text.substr(6), 6, &version.beta)) return std::nullopt;+ return version;}- return Version{parts[0], parts[1], parts[2], beta};+ // -nightly.YYYYMMDD.N, with a plausible date.+ if (text.substr(0, 9) != "-nightly.") return std::nullopt;+ text.remove_prefix(9);+ const auto dot = text.find('.');+ if (dot != 8 || !ParseCount(text.substr(0, 8), 8, &version.nightly_date) ||+ !ParseCount(text.substr(9), 3, &version.nightly_build))+ return std::nullopt;+ const unsigned month = version.nightly_date / 100 % 100, day = version.nightly_date % 100;+ if (version.nightly_date < 20000101 || month < 1 || month > 12 || day < 1 || day > 31) return std::nullopt;+ return version;}Version CurrentVersion() {@@ -47,4 +71,6 @@ Version CurrentVersion() {return version;}+std::string BuildCommit() { return PLAYDEN_BUILD_COMMIT; }+} // namespace playden::updatediff --git a/src/update/version.h b/src/update/version.hindex 15af763..3757429 100644--- a/src/update/version.h+++ b/src/update/version.h@@ -1,5 +1,5 @@#pragma once-// version.h - Playden release versions: "0.2.0", tags "v0.2.0" and param.json "00.002.000".+// version.h - Playden versions: "0.2.0", tags "v0.2.0", param.json "00.002.000" and nightly builds.// Copyright (c) 2026 Playden contributors// SPDX-License-Identifier: MIT#include <optional>@@ -13,26 +13,39 @@ struct Version {unsigned minor = 0;unsigned patch = 0;unsigned beta = 0; // 0 is stable, newer than every beta of the same version.+ // A nightly test build (YYYYMMDD and that day's build number), never a release. A version's nightlies+ // come before its betas and its stable release, so an update to either is offered.+ unsigned nightly_date = 0;+ unsigned nightly_build = 0;- std::string ToString() const; // "0.2.0"+ bool nightly() const { return nightly_date != 0; }+ std::string ToString() const; // "0.2.0", "0.7.1-beta.1", "0.8.0-nightly.20261027.1"friend bool operator==(const Version& a, const Version& b) {- return a.major == b.major && a.minor == b.minor && a.patch == b.patch && a.beta == b.beta;+ return a.major == b.major && a.minor == b.minor && a.patch == b.patch && a.beta == b.beta &&+ a.nightly_date == b.nightly_date && a.nightly_build == b.nightly_build;}friend bool operator!=(const Version& a, const Version& b) { return !(a == b); }friend bool operator<(const Version& a, const Version& b) {if (a.major != b.major) return a.major < b.major;if (a.minor != b.minor) return a.minor < b.minor;if (a.patch != b.patch) return a.patch < b.patch;- if (a.beta == b.beta) return false;- return a.beta != 0 && (b.beta == 0 || a.beta < b.beta);+ // Nightly, then beta, then stable.+ const auto rank = [](const Version& v) { return v.nightly() ? 0 : v.beta ? 1 : 2; };+ if (rank(a) != rank(b)) return rank(a) < rank(b);+ if (a.nightly()) return a.nightly_date != b.nightly_date ? a.nightly_date < b.nightly_date : a.nightly_build < b.nightly_build;+ return a.beta < b.beta;}};// Three dot-separated numbers, with an optional leading "v". Each part is 1-6 digits (param.json-// pads them with zeros). Optional suffix: -beta.N, N is 1-999999 with no leading zero.+// pads them with zeros). Optional suffix: -beta.N, N is 1-999999 with no leading zero; or+// -nightly.YYYYMMDD.N, N is 1-999 with no leading zero.std::optional<Version> ParseVersion(std::string_view text);-// The version this build was made from (CMake's PROJECT_VERSION).+// The version this build was made from (CMake's PROJECT_VERSION and pre-release suffix).Version CurrentVersion();+// The commit this build was made from (10 hex digits), or empty when the source was not a git checkout.+std::string BuildCommit();+} // namespace playden::updatediff --git a/tests/homebrew_live_model_test.cpp b/tests/homebrew_live_model_test.cppindex db40549..3d896ad 100644--- a/tests/homebrew_live_model_test.cpp+++ b/tests/homebrew_live_model_test.cpp@@ -827,6 +827,22 @@ void live_self_update(const std::filesystem::path& base) {find_row(model, "settings-beta-wait")->subtitle =="Playden moves to the next stable version when it is out.","opting out on a beta explains waiting for stable");+ // Settings › About names a nightly as such, with its build number and commit.+ update.current = "0.8.0-nightly.20261027.2";+ update.commit = "d94c0b384d";+ model.UpdateSelfUpdate(update);+ activate(model, "settings-about");+ check(find_row(model, "about-version") && find_row(model, "about-version")->value == "Playden 0.8.0 (Nightly)",+ "about: a nightly's version");+ check(find_row(model, "about-build") && find_row(model, "about-build")->value == "Nightly 20261027.2 · d94c0b384d",+ "about: a nightly's build and commit");+ update.current = "0.7.1-beta.1";+ model.UpdateSelfUpdate(update);+ check(find_row(model, "about-version")->value == "Playden 0.7.1-beta.1 (Beta)" &&+ find_row(model, "about-build")->value == "d94c0b384d",+ "about: a beta's version and commit");+ model.action("circle");+ update.commit.clear();update.current = "0.2.0";model.UpdateSelfUpdate(update);check(find_row(model, "settings-update") && find_row(model, "settings-update")->value == "Check now",diff --git a/tests/self_update_release_test.cpp b/tests/self_update_release_test.cppindex c268dbb..141411b 100644--- a/tests/self_update_release_test.cpp+++ b/tests/self_update_release_test.cpp@@ -38,6 +38,7 @@ int main() {CHECK(!release->Find("broken"));CHECK(ParseRelease(R"({"tag_name":"v0.3.0","prerelease":true,"assets":[]})", &error)->prerelease);CHECK(!ParseRelease(R"({"tag_name":"nightly","assets":[]})", &error));+ CHECK(!ParseRelease(R"({"tag_name":"v0.8.0-nightly.20261027.1","assets":[]})", &error)); // never a releaseCHECK(!ParseRelease(R"({"tag_name":"v0.3.0"})", &error));CHECK(!ParseRelease("[]", &error));CHECK(!ParseRelease("not json", &error));@@ -67,6 +68,11 @@ int main() {// Unsafe or incomplete manifests are refused.CHECK(!ParseUpdateManifest(R"({"format":2})", &error));+ {+ std::string nightly = Manifest();+ nightly.replace(nightly.find(R"("version":"0.3.0")"), 17, R"("version":"0.3.0-nightly.20261027.1")");+ CHECK(!ParseUpdateManifest(nightly, &error));+ }std::string text = Manifest();CHECK(!ParseUpdateManifest(text.replace(text.find("\"format\":1"), 10, "\"format\":2"), &error));const char* bad_apps[] = {diff --git a/tests/self_update_service_test.cpp b/tests/self_update_service_test.cppindex 9531904..6344a40 100644--- a/tests/self_update_service_test.cpp+++ b/tests/self_update_service_test.cpp@@ -257,6 +257,34 @@ int main() {local.Check(true); Wait(local);CHECK(local.Snapshot().phase == UpdatePhase::kFailed);}+ // A nightly build is offered its version's stable release, and its betas when they are opted in; its+ // notes link to the page that lists the nightlies.+ {+ Fixture fixture;+ fixture.root = zip_fixture::TempFolder("nightly-track");+ Installed(fixture.root);+ Publish(fixture.server, "v0.7.0", "0.7.0", "00.007.000");+ auto config = fixture.Config(*ParseVersion("0.7.1-nightly.20261027.1"));+ config.nightly_page = "https://builds.example/";+ UpdateService before(config);+ before.Start();+ before.Check(true); Wait(before);+ CHECK(before.Snapshot().phase == UpdatePhase::kUpToDate); // an older release is no update+ CHECK(before.Snapshot().current_notes_url == "https://builds.example/");+ Publish(fixture.server, "v0.7.1-beta.1", "0.7.0", "00.007.001");+ auto beta = fixture.server.latest;+ beta.replace(beta.find("\"prerelease\":false"), 18, "\"prerelease\":true");+ fixture.server.releases = "[" + beta + "]";+ config.include_betas = true;+ UpdateService betas(config);+ betas.Check(true); Wait(betas);+ CHECK(betas.Snapshot().phase == UpdatePhase::kAvailable && betas.Snapshot().available.ToString() == "0.7.1-beta.1");+ Publish(fixture.server, "v0.7.1", "0.7.0", "00.007.001");+ config.include_betas = false;+ UpdateService stable(config);+ stable.Check(true); Wait(stable);+ CHECK(stable.Snapshot().phase == UpdatePhase::kAvailable && stable.Snapshot().available.ToString() == "0.7.1");+ }// Opting out during a download and cancelling must not leave a beta installable.{Fixture fixture;diff --git a/tests/self_update_version_test.cpp b/tests/self_update_version_test.cppindex 8e6e77f..e4618b2 100644--- a/tests/self_update_version_test.cpp+++ b/tests/self_update_version_test.cpp@@ -17,6 +17,9 @@ int main() {CHECK((Version{0, 3, 10}).ToString() == "0.3.10");// The build's own version comes from CMake.CHECK(ParseVersion(PLAYDEN_VERSION) && CurrentVersion() == *ParseVersion(PLAYDEN_VERSION));+ // And its commit from git, when the source is a checkout.+ CHECK(BuildCommit() == PLAYDEN_BUILD_COMMIT);+ CHECK(BuildCommit().empty() || BuildCommit().find_first_not_of("0123456789abcdef") == std::string::npos);const auto beta = ParseVersion("v0.7.1-beta.1");CHECK(beta);CHECK(beta->ToString() == "0.7.1-beta.1");@@ -28,5 +31,23 @@ int main() {for (const char* bad : {"0.7.1-rc.1", "0.7.1-beta.0", "0.7.1-beta.01", "0.7.1-beta.1000000","0.7.1-beta.-1", "0.7.1-beta.1+meta", "0.7.1+meta", "0.7.1-beta.1.2"})CHECK(!ParseVersion(bad));+ // Nightly builds: before every beta and the stable release of their version, after the one before.+ const auto nightly = ParseVersion("0.8.0-nightly.20261027.2");+ CHECK(nightly && nightly->nightly() && nightly->nightly_date == 20261027 && nightly->nightly_build == 2);+ CHECK(nightly->ToString() == "0.8.0-nightly.20261027.2");+ CHECK(ParseVersion(nightly->ToString()) == nightly);+ CHECK(*ParseVersion("0.7.2") < *nightly);+ CHECK(*ParseVersion("0.8.0-nightly.20261027.1") < *nightly);+ CHECK(*nightly < *ParseVersion("0.8.0-nightly.20261028.1"));+ CHECK(*nightly < *ParseVersion("0.8.0-beta.1"));+ CHECK(*nightly < *ParseVersion("0.8.0"));+ CHECK(!(*ParseVersion("0.8.0") < *nightly) && !(*ParseVersion("0.8.0-beta.1") < *nightly));+ CHECK(*nightly < *ParseVersion("0.8.1-nightly.20200101.1"));+ CHECK(*nightly != *ParseVersion("0.8.0-nightly.20261027.3"));+ for (const char* bad : {"0.8.0-nightly", "0.8.0-nightly.20261027", "0.8.0-nightly.20261027.0", "0.8.0-nightly.20261027.01",+ "0.8.0-nightly.20261027.1000", "0.8.0-nightly.2026102.1", "0.8.0-nightly.20261327.1",+ "0.8.0-nightly.20261000.1", "0.8.0-nightly.020261027.1", "0.8.0-nightly.20261027.1.1",+ "0.8.0-beta.1-nightly.20261027.1", "0.8.0-nightly.20261027.1-beta.1"})+ CHECK(!ParseVersion(bad));return 0;}