mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-20 03:35:46 +00:00
Fix build ID and update checker (#148)
Signed-off-by: swurl <swurl@swurl.xyz> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/148 Co-authored-by: swurl <swurl@swurl.xyz> Co-committed-by: swurl <swurl@swurl.xyz>
This commit is contained in:
parent
d2364ae1f7
commit
7e13da47af
5 changed files with 45 additions and 47 deletions
|
@ -20,37 +20,19 @@ if (NOT GIT_BRANCH)
|
||||||
endif()
|
endif()
|
||||||
get_timestamp(BUILD_DATE)
|
get_timestamp(BUILD_DATE)
|
||||||
|
|
||||||
# Generate cpp with Git revision from template
|
git_get_exact_tag(GIT_TAG --tags)
|
||||||
# Also if this is a CI build, add the build name (ie: Nightly, Canary) to the scm_rev file as well
|
if (GIT_TAG MATCHES "NOTFOUND")
|
||||||
set(REPO_NAME "")
|
set(BUILD_VERSION "${GIT_DESC}")
|
||||||
set(BUILD_VERSION "0")
|
set(IS_DEV_BUILD true)
|
||||||
set(BUILD_ID ${DISPLAY_VERSION})
|
else()
|
||||||
if (BUILD_REPOSITORY)
|
set(BUILD_VERSION ${GIT_TAG})
|
||||||
# regex capture the string nightly or canary into CMAKE_MATCH_1
|
set(IS_DEV_BUILD false)
|
||||||
string(REGEX MATCH "yuzu-emu/yuzu-?(.*)" OUTVAR ${BUILD_REPOSITORY})
|
|
||||||
if ("${CMAKE_MATCH_COUNT}" GREATER 0)
|
|
||||||
# capitalize the first letter of each word in the repo name.
|
|
||||||
string(REPLACE "-" ";" REPO_NAME_LIST ${CMAKE_MATCH_1})
|
|
||||||
foreach(WORD ${REPO_NAME_LIST})
|
|
||||||
string(SUBSTRING ${WORD} 0 1 FIRST_LETTER)
|
|
||||||
string(SUBSTRING ${WORD} 1 -1 REMAINDER)
|
|
||||||
string(TOUPPER ${FIRST_LETTER} FIRST_LETTER)
|
|
||||||
set(REPO_NAME "${REPO_NAME}${FIRST_LETTER}${REMAINDER}")
|
|
||||||
endforeach()
|
|
||||||
if (BUILD_TAG)
|
|
||||||
string(REGEX MATCH "${CMAKE_MATCH_1}-([0-9]+)" OUTVAR ${BUILD_TAG})
|
|
||||||
if (${CMAKE_MATCH_COUNT} GREATER 0)
|
|
||||||
set(BUILD_VERSION ${CMAKE_MATCH_1})
|
|
||||||
endif()
|
|
||||||
if (BUILD_VERSION)
|
|
||||||
# This leaves a trailing space on the last word, but we actually want that
|
|
||||||
# because of how it's styled in the title bar.
|
|
||||||
set(BUILD_FULLNAME "${REPO_NAME} ${BUILD_VERSION} ")
|
|
||||||
else()
|
|
||||||
set(BUILD_FULLNAME "")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Generate cpp with Git revision from template
|
||||||
|
# Also if this is a CI build, add the build name (ie: Nightly, Canary) to the scm_rev file as well
|
||||||
|
set(REPO_NAME "eden")
|
||||||
|
set(BUILD_ID ${GIT_BRANCH})
|
||||||
|
set(BUILD_FULLNAME "${REPO_NAME} ${BUILD_VERSION} ")
|
||||||
|
|
||||||
configure_file(scm_rev.cpp.in scm_rev.cpp @ONLY)
|
configure_file(scm_rev.cpp.in scm_rev.cpp @ONLY)
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#define BUILD_ID "@BUILD_ID@"
|
#define BUILD_ID "@BUILD_ID@"
|
||||||
#define TITLE_BAR_FORMAT_IDLE "@TITLE_BAR_FORMAT_IDLE@"
|
#define TITLE_BAR_FORMAT_IDLE "@TITLE_BAR_FORMAT_IDLE@"
|
||||||
#define TITLE_BAR_FORMAT_RUNNING "@TITLE_BAR_FORMAT_RUNNING@"
|
#define TITLE_BAR_FORMAT_RUNNING "@TITLE_BAR_FORMAT_RUNNING@"
|
||||||
|
#define IS_DEV_BUILD @IS_DEV_BUILD@
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
|
@ -30,6 +31,7 @@ const char g_build_version[] = BUILD_VERSION;
|
||||||
const char g_build_id[] = BUILD_ID;
|
const char g_build_id[] = BUILD_ID;
|
||||||
const char g_title_bar_format_idle[] = TITLE_BAR_FORMAT_IDLE;
|
const char g_title_bar_format_idle[] = TITLE_BAR_FORMAT_IDLE;
|
||||||
const char g_title_bar_format_running[] = TITLE_BAR_FORMAT_RUNNING;
|
const char g_title_bar_format_running[] = TITLE_BAR_FORMAT_RUNNING;
|
||||||
|
const bool g_is_dev_build = IS_DEV_BUILD;
|
||||||
|
|
||||||
/// Anonymizes SCM data
|
/// Anonymizes SCM data
|
||||||
/// This is quite weak. But better than nothing.
|
/// This is quite weak. But better than nothing.
|
||||||
|
|
|
@ -16,5 +16,6 @@ extern const char g_build_id[];
|
||||||
extern const char g_title_bar_format_idle[];
|
extern const char g_title_bar_format_idle[];
|
||||||
extern const char g_title_bar_format_running[];
|
extern const char g_title_bar_format_running[];
|
||||||
extern const char g_shader_cache_version[];
|
extern const char g_shader_cache_version[];
|
||||||
|
extern const bool g_is_dev_build;
|
||||||
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
|
|
@ -1,21 +1,29 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "yuzu/about_dialog.h"
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <fmt/ranges.h>
|
|
||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
#include "ui_aboutdialog.h"
|
#include "ui_aboutdialog.h"
|
||||||
#include "yuzu/about_dialog.h"
|
#include <fmt/ranges.h>
|
||||||
|
|
||||||
AboutDialog::AboutDialog(QWidget* parent)
|
AboutDialog::AboutDialog(QWidget* parent)
|
||||||
: QDialog(parent), ui{std::make_unique<Ui::AboutDialog>()} {
|
: QDialog(parent)
|
||||||
const auto branch_name = std::string(Common::g_scm_branch);
|
, ui{std::make_unique<Ui::AboutDialog>()}
|
||||||
const auto description = std::string(Common::g_scm_desc);
|
{
|
||||||
|
const auto description = std::string(Common::g_build_version);
|
||||||
const auto build_id = std::string(Common::g_build_id);
|
const auto build_id = std::string(Common::g_build_id);
|
||||||
|
|
||||||
const auto yuzu_build = fmt::format("eden Development Build | {}-{}", branch_name, description);
|
std::string yuzu_build;
|
||||||
const auto override_build =
|
if (Common::g_is_dev_build) {
|
||||||
fmt::format(fmt::runtime(std::string(Common::g_title_bar_format_idle)), build_id);
|
yuzu_build = fmt::format("eden Nightly | {}-{}", description, build_id);
|
||||||
|
} else {
|
||||||
|
yuzu_build = fmt::format("eden | {}", description);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto override_build = fmt::format(fmt::runtime(
|
||||||
|
std::string(Common::g_title_bar_format_idle)),
|
||||||
|
build_id);
|
||||||
const auto yuzu_build_version = override_build.empty() ? yuzu_build : override_build;
|
const auto yuzu_build_version = override_build.empty() ? yuzu_build : override_build;
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
|
@ -420,13 +420,13 @@ GMainWindow::GMainWindow(bool has_broken_vulkan)
|
||||||
if (UISettings::values.check_for_updates) {
|
if (UISettings::values.check_for_updates) {
|
||||||
update_future = QtConcurrent::run([]() -> QString {
|
update_future = QtConcurrent::run([]() -> QString {
|
||||||
const bool is_prerelease =
|
const bool is_prerelease =
|
||||||
((strstr(Common::g_build_fullname, "pre-alpha") != NULL) ||
|
((strstr(Common::g_build_version, "pre-alpha") != NULL) ||
|
||||||
(strstr(Common::g_build_fullname, "alpha") != NULL) ||
|
(strstr(Common::g_build_version, "alpha") != NULL) ||
|
||||||
(strstr(Common::g_build_fullname, "beta") != NULL) ||
|
(strstr(Common::g_build_version, "beta") != NULL) ||
|
||||||
(strstr(Common::g_build_fullname, "rc") != NULL));
|
(strstr(Common::g_build_version, "rc") != NULL));
|
||||||
const std::optional<std::string> latest_release_tag =
|
const std::optional<std::string> latest_release_tag =
|
||||||
UpdateChecker::GetLatestRelease(is_prerelease);
|
UpdateChecker::GetLatestRelease(is_prerelease);
|
||||||
if (latest_release_tag && latest_release_tag.value() != Common::g_build_fullname) {
|
if (latest_release_tag && latest_release_tag.value() != Common::g_build_version) {
|
||||||
return QString::fromStdString(latest_release_tag.value());
|
return QString::fromStdString(latest_release_tag.value());
|
||||||
}
|
}
|
||||||
return QString{};
|
return QString{};
|
||||||
|
@ -4796,11 +4796,16 @@ void GMainWindow::OnEmulatorUpdateAvailable() {
|
||||||
|
|
||||||
void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_view title_version,
|
void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_view title_version,
|
||||||
std::string_view gpu_vendor) {
|
std::string_view gpu_vendor) {
|
||||||
const auto branch_name = std::string(Common::g_scm_branch);
|
const auto description = std::string(Common::g_build_version);
|
||||||
const auto description = std::string(Common::g_scm_desc);
|
|
||||||
const auto build_id = std::string(Common::g_build_id);
|
const auto build_id = std::string(Common::g_build_id);
|
||||||
|
|
||||||
const auto yuzu_title = fmt::format("eden | {}-{}", branch_name, description);
|
std::string yuzu_title;
|
||||||
|
if (Common::g_is_dev_build) {
|
||||||
|
yuzu_title = fmt::format("eden Nightly | {}-{}", description, build_id);
|
||||||
|
} else {
|
||||||
|
yuzu_title = fmt::format("eden | {}", description);
|
||||||
|
}
|
||||||
|
|
||||||
const auto override_title =
|
const auto override_title =
|
||||||
fmt::format(fmt::runtime(std::string(Common::g_title_bar_format_idle)), build_id);
|
fmt::format(fmt::runtime(std::string(Common::g_title_bar_format_idle)), build_id);
|
||||||
const auto window_title = override_title.empty() ? yuzu_title : override_title;
|
const auto window_title = override_title.empty() ? yuzu_title : override_title;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue