dev: specify nightly tag through cmake instead of modes file (#6798)

This commit is contained in:
pajlada
2026-02-08 11:59:34 +01:00
committed by GitHub
parent f7aa5959c1
commit 43ac9c38db
11 changed files with 87 additions and 25 deletions
+1
View File
@@ -1133,6 +1133,7 @@ target_compile_definitions(${VERSION_PROJECT} PRIVATE
CHATTERINO_GIT_RELEASE=\"${GIT_RELEASE}\"
CHATTERINO_GIT_COMMIT=\"${GIT_COMMIT}\"
CHATTERINO_GIT_MODIFIED=${GIT_MODIFIED}
CHATTERINO_NIGHTLY_BUILD=$<BOOL:${CHATTERINO_NIGHTLY_BUILD}>
CHATTERINO_CMAKE_GEN_DATE=\"${cmake_gen_date}\"
)
+1 -6
View File
@@ -22,12 +22,7 @@ Modes::Modes()
{
auto line = QString(file.readLine()).trimmed();
// we need to know if it is a nightly build to disable updates on windows
if (line == "nightly")
{
this->isNightly = true;
}
else if (line == "portable")
if (line == "portable")
{
this->isPortable = true;
}
-1
View File
@@ -13,7 +13,6 @@ public:
static const Modes &instance();
bool isNightly{};
bool isPortable{};
/// Marked by the line `externally-packaged`
+10 -7
View File
@@ -4,24 +4,22 @@
#include "common/Version.hpp"
#include "common/Literals.hpp"
#include "common/Modes.hpp"
#include <QFileInfo>
#include <QStringBuilder>
namespace chatterino {
using namespace Qt::StringLiterals;
using namespace literals;
namespace chatterino {
Version::Version()
: version_(CHATTERINO_VERSION)
, commitHash_(QStringLiteral(CHATTERINO_GIT_HASH))
, isModified_(CHATTERINO_GIT_MODIFIED == 1)
, dateOfBuild_(QStringLiteral(CHATTERINO_CMAKE_GEN_DATE))
, isNightly_(CHATTERINO_NIGHTLY_BUILD == 1)
{
this->fullVersion_ = "Chatterino ";
if (Modes::instance().isNightly)
if (this->isNightly())
{
this->fullVersion_ += "Nightly ";
}
@@ -129,6 +127,11 @@ const QString &Version::extraString() const
return this->extraString_;
}
bool Version::isNightly() const
{
return this->isNightly_;
}
void Version::generateBuildString()
{
// e.g. Chatterino 2.3.5 or Chatterino Nightly 2.3.5
@@ -151,7 +154,7 @@ void Version::generateBuildString()
s += " built";
// If the build is a nightly build (decided with modes atm), include build date information
if (Modes::instance().isNightly)
if (this->isNightly())
{
s += " on " + this->dateOfBuild();
}
+7
View File
@@ -63,6 +63,11 @@ public:
// Returns an extra string about this specific build
const QString &extraString() const;
/// Returns true if this build is classified as a "nightly" (i.e. dev or unstable) build.
///
/// This is controlled by the CMake parameter CHATTERINO_NIGHTLY_BUILD, which defaults to off.
bool isNightly() const;
#ifdef Q_OS_WIN
/// Chatterino's App ID on Windows
///
@@ -92,6 +97,8 @@ private:
// Generate an extra string (e.g. "Built for Fedora 42.<br>Report bugs <a href...>here</a>")
void generateExtraString();
bool isNightly_;
#ifdef Q_OS_WIN
std::wstring appUserModelID_;
#endif
+1 -2
View File
@@ -102,8 +102,7 @@ int main(int argc, char **argv)
QString("%1 (commit %2%3)")
.arg(version.fullVersion())
.arg(version.commitHash())
.arg(Modes::instance().isNightly ? ", " + version.dateOfBuild()
: "");
.arg(version.isNightly() ? ", " + version.dateOfBuild() : "");
std::cout << versionMessage.toLocal8Bit().constData() << '\n';
std::cout.flush();
}
+1 -1
View File
@@ -315,7 +315,7 @@ void Updates::checkForUpdates()
}
// Disable updates if on nightly
if (Modes::instance().isNightly)
if (version.isNightly())
{
return;
}
+4 -7
View File
@@ -5,8 +5,7 @@
#include "widgets/dialogs/LastRunCrashDialog.hpp"
#include "common/Args.hpp"
#include "common/Literals.hpp"
#include "common/Modes.hpp"
#include "common/Version.hpp" // IWYU pragma: keep
#include "singletons/Paths.hpp"
#include "util/LayoutCreator.hpp"
@@ -21,9 +20,9 @@
#include <QStringBuilder>
#include <QVBoxLayout>
namespace {
using namespace Qt::StringLiterals;
using namespace chatterino::literals;
namespace {
const std::initializer_list<QString> MESSAGES = {
u"Oops..."_s, u"NotLikeThis"_s,
@@ -45,8 +44,6 @@ QString randomMessage()
namespace chatterino {
using namespace literals;
LastRunCrashDialog::LastRunCrashDialog(const Args &args, const Paths &paths)
{
this->setWindowFlag(Qt::WindowContextHelpButtonHint, false);
@@ -85,7 +82,7 @@ LastRunCrashDialog::LastRunCrashDialog(const Args &args, const Paths &paths)
"the crash</a> "
u"so it can be prevented in the future."_s;
if (Modes::instance().isNightly)
if (Version::instance().isNightly())
{
text += u" Make sure you're using the latest nightly version!"_s;
}