Skip to content

Commit 3403b53

Browse files
committed
Don't use Git in the build system
Stop using Git to determine a version number based on tags; just write the version number in the source code. The immediate motivation is that I don't want to have to migrate this stuff to CMake. But anyway I think it's a bad idea for various reasons: - Doesn't work correctly with incremental rebuilds. - Unnecessarily adds another program as a build dependency. - It's possible to fetch a commit without fetching all the tags, meaning you don't have the latest tag. - The latest tag could be something other than a release. Maybe you fetched from an alternative remote and somebody added a random tag. Maybe we wanted to use a tag for some reason other than a release.
1 parent c3e35ca commit 3403b53

File tree

6 files changed

+12
-8
lines changed

6 files changed

+12
-8
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ FROM docker.io/debian:bullseye-slim
77
# updater builds but icons (gear, download, etc.) are mysteriously missing, when built in the
88
# Bullseye environment. It may be that not all are necessary.
99
# aria2 build requires autoconf, autopoint, gettext
10-
# updater build requires git
10+
# git is used for cleaning unwanted files
1111
RUN apt-get update && apt-get install -y \
1212
autoconf \
1313
autopoint \

deployment.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
- Torrent URL used to download the latest game version
66

77
## Release process
8-
1. Create a new Git tag.
9-
2. Make a Github release with the same name as the tag. Build and upload the files for each platform:
8+
1. Make a commit updating the version string in `updaterAppVersion()` in `splashcontroller.h`.
9+
2. Create a new Git tag matching the version string.
10+
3. Make a Github release with the same name as the tag/version string. Build and upload the files for each platform:
1011
### Mac
1112
1. `rm -rf build/`
1213
2. Follow the __Build Mac version natively__ instructions in the README.

main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ CommandLineOptions getCommandLineOptions(const QApplication& app) {
159159
int main(int argc, char *argv[])
160160
{
161161
Sys::initApplicationName();
162-
QCoreApplication::setApplicationVersion(GIT_VERSION);
162+
QCoreApplication::setApplicationVersion(updaterAppVersion());
163163
QCoreApplication::setOrganizationDomain("unvanquished.net");
164164
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
165165
QApplication app(argc, argv);
@@ -188,7 +188,7 @@ int main(int argc, char *argv[])
188188
qDebug() << "Will connect to URL:" << options.connectUrl;
189189
}
190190

191-
qDebug() << "Git version:" << GIT_VERSION;
191+
qDebug() << "Git version:" << updaterAppVersion();
192192
LogSettings();
193193
try {
194194
qDebug() << "Testing exception handling...";

splashcontroller.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void SplashController::autoLaunchOrUpdate()
9595
}
9696

9797
// If no relaunch action, detect update needed based on versions.json
98-
if (!latestUpdaterVersion_.isEmpty() && latestUpdaterVersion_ != QString(GIT_VERSION)) {
98+
if (!latestUpdaterVersion_.isEmpty() && latestUpdaterVersion_ != updaterAppVersion()) {
9999
qDebug() << "Updater update to version" << latestUpdaterVersion_ << "required";
100100
// Remember the URL if we are doing updater update
101101
QString updaterArgs = "--splashms 1 --internalcommand updateupdater:" + latestUpdaterVersion_;

splashcontroller.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
#include "currentversionfetcher.h"
2525
#include "settings.h"
2626

27+
inline QString updaterAppVersion()
28+
{
29+
return "v0.2.1";
30+
}
31+
2732
// These are used only on Windows where relaunching is needed for admin (de)elevation.
2833
enum class RelaunchCommand
2934
{

updater.pro

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ mac {
3333
SOURCES += win.cpp ExecInExplorer.cpp
3434
}
3535

36-
GIT_VERSION = $$system(git --git-dir $$PWD/.git --work-tree $$PWD describe --always --tags --abbrev=0)
37-
DEFINES += GIT_VERSION=\\\"$$GIT_VERSION\\\"
3836
DEFINES += QUAZIP_BUILD
3937
DEFINES += QUAZIP_STATIC
4038
include(quazip/quazip/quazip.pri)

0 commit comments

Comments
 (0)