Merge pull request #173 from OpenVR-Advanced-Settings/version-string-file
Convert version string to be read from single file
This commit is contained in:
@@ -28,6 +28,7 @@ init:
|
|||||||
- set TAG_NAME=%APPVEYOR_REPO_TAG_NAME%
|
- set TAG_NAME=%APPVEYOR_REPO_TAG_NAME%
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
|
- python ./build_scripts/append_to_version_file.py %APPVEYOR_REPO_COMMIT:~0,8%
|
||||||
- python ./build_scripts/run-clang-format.py ./src -r --clang-format-executable "C:\Program Files\LLVM\bin\clang-format.exe" --color always
|
- python ./build_scripts/run-clang-format.py ./src -r --clang-format-executable "C:\Program Files\LLVM\bin\clang-format.exe" --color always
|
||||||
- call "build_windows.cmd"
|
- call "build_windows.cmd"
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ debug
|
|||||||
release
|
release
|
||||||
assets
|
assets
|
||||||
bin
|
bin
|
||||||
|
build
|
||||||
Makefile*
|
Makefile*
|
||||||
*.vcxproj*
|
*.vcxproj*
|
||||||
*.log
|
*.log
|
||||||
@@ -13,3 +14,4 @@ installer/*.exe
|
|||||||
*.user*
|
*.user*
|
||||||
build_scripts/win/__pycache__
|
build_scripts/win/__pycache__
|
||||||
build_scripts/win/current_build.bat
|
build_scripts/win/current_build.bat
|
||||||
|
AdvancedSettings_resource.rc
|
||||||
|
|||||||
@@ -3,6 +3,17 @@ CONFIG += c++1z
|
|||||||
|
|
||||||
DEFINES += ELPP_THREAD_SAFE ELPP_QT_LOGGING ELPP_NO_DEFAULT_LOG_FILE
|
DEFINES += ELPP_THREAD_SAFE ELPP_QT_LOGGING ELPP_NO_DEFAULT_LOG_FILE
|
||||||
|
|
||||||
|
VERSION = "$$cat($$PWD/build_scripts/compile_version_string.txt)"
|
||||||
|
DEFINES += APPLICATION_VERSION=\\\"$$VERSION\\\"
|
||||||
|
# Qmake can't handle non-integers in the version string,
|
||||||
|
# so we take out anything after the dash.
|
||||||
|
SPLIT_VERSION_STRING = $$split(VERSION, -)
|
||||||
|
NUMERICAL_VERSION_NUMBER = $$member(SPLIT_VERSION_STRING, 0, 0)
|
||||||
|
VERSION = $$NUMERICAL_VERSION_NUMBER
|
||||||
|
|
||||||
|
# Keep the literal version number in the description field for debugging.
|
||||||
|
QMAKE_TARGET_DESCRIPTION = "$$cat($$PWD/build_scripts/compile_version_string.txt)"
|
||||||
|
|
||||||
lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5.12 or higher")
|
lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5.12 or higher")
|
||||||
lessThan(QT_MINOR_VERSION, 12): error("requires Qt 5.12 or higher")
|
lessThan(QT_MINOR_VERSION, 12): error("requires Qt 5.12 or higher")
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
from sys import argv
|
||||||
|
from os import path, remove
|
||||||
|
|
||||||
|
current_path = path.dirname(path.realpath(__file__))
|
||||||
|
version_file_path = path.join(current_path, "compile_version_string.txt")
|
||||||
|
|
||||||
|
def get_version_string():
|
||||||
|
with open(version_file_path, "r") as file:
|
||||||
|
contents = file.readline()
|
||||||
|
return contents.strip('"')
|
||||||
|
|
||||||
|
def set_version_string(new_version_string):
|
||||||
|
remove(version_file_path)
|
||||||
|
with open(version_file_path, "w") as file:
|
||||||
|
file.write(new_version_string)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
current_version = get_version_string()
|
||||||
|
if "-release" in current_version.lower():
|
||||||
|
current_version.replace("-release", "")
|
||||||
|
else:
|
||||||
|
new_version = current_version + "+" + argv[1]
|
||||||
|
|
||||||
|
set_version_string(new_version)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
3.1.0-dev
|
||||||
@@ -47,4 +47,4 @@ DISTFILES += \
|
|||||||
src/res/qml/desktop_overlay_page/translation_back_forwards/SteamDesktopTranslationBackForwards.qml \
|
src/res/qml/desktop_overlay_page/translation_back_forwards/SteamDesktopTranslationBackForwards.qml \
|
||||||
src/res/qml/desktop_overlay_page/translation_up_down/SteamDesktopTranslationUpDown.qml \
|
src/res/qml/desktop_overlay_page/translation_up_down/SteamDesktopTranslationUpDown.qml \
|
||||||
|
|
||||||
RC_FILE = src/res/icon.rc
|
win32:RC_ICONS += src/res/img/icons/advicon256px.ico
|
||||||
|
|||||||
@@ -154,6 +154,8 @@ def build():
|
|||||||
COMPILE_MODE = ""
|
COMPILE_MODE = ""
|
||||||
COMPILER = ""
|
COMPILER = ""
|
||||||
|
|
||||||
|
say("Attempting to build version: " + VERSION_STRING)
|
||||||
|
|
||||||
say("Testing if all required build environment variables are set:")
|
say("Testing if all required build environment variables are set:")
|
||||||
QT_LOC = get_required_env_var_path(QT_LOC_VAR_NAME, QT_LOC_DEFAULT)
|
QT_LOC = get_required_env_var_path(QT_LOC_VAR_NAME, QT_LOC_DEFAULT)
|
||||||
VS_LOC = get_required_env_var_path(VS_LOC_VAR_NAME, VS_LOC_DEFAULT)
|
VS_LOC = get_required_env_var_path(VS_LOC_VAR_NAME, VS_LOC_DEFAULT)
|
||||||
|
|||||||
@@ -8,10 +8,15 @@ import subprocess
|
|||||||
import shutil
|
import shutil
|
||||||
import distutils.dir_util
|
import distutils.dir_util
|
||||||
|
|
||||||
|
def get_version_string():
|
||||||
|
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
with open(dir_path + "/../compile_version_string.txt", "r") as file:
|
||||||
|
contents = file.readline()
|
||||||
|
return contents
|
||||||
|
|
||||||
|
|
||||||
#Const globals
|
#Const globals
|
||||||
#Version string must be bumped every release.
|
VERSION_STRING = get_version_string()
|
||||||
#TODO: See developer documentation.
|
|
||||||
VERSION_STRING = "3-1-0-dev"
|
|
||||||
|
|
||||||
EXIT_CODE_SUCCESS = 0
|
EXIT_CODE_SUCCESS = 0
|
||||||
EXIT_CODE_FAILURE_BUILD_APP = 1
|
EXIT_CODE_FAILURE_BUILD_APP = 1
|
||||||
|
|||||||
+6
-12
@@ -1,23 +1,17 @@
|
|||||||
<a name="top"></a>
|
|
||||||
# OpenVR Advanced Settings Developer Docs
|
# OpenVR Advanced Settings Developer Docs
|
||||||
|
|
||||||
For things that don't directly belong a single place in the source code.
|
For things that don't directly belong a single place in the source code.
|
||||||
|
|
||||||
> * [New Patch Release Checklist](#patch_checklist)
|
# New Patch Release Checklist
|
||||||
> * [Increment Version Numbers](#inc_vers_numbers)
|
|
||||||
|
|
||||||
<a name="patch_checklist"></a>
|
## Increment Version Numbers
|
||||||
## New Patch Release Checklist
|
|
||||||
|
|
||||||
<a name="inc_vers_numbers"></a>
|
The version number string is kept in the `./build_scripts/compile_version_string.txt` file. The file is read by at compile time by whatever needs the current version number. Currently it is being used in 3 locations.
|
||||||
### Increment Version Numbers
|
|
||||||
|
|
||||||
Currently there are three version strings in the source.
|
1. `advancedSettings.pro` - `VERSION` variable and `APPLICATION_VERSION` define.
|
||||||
|
|
||||||
1. `src\overlaycontroller.h` - Variable named `applicationVersionString`.
|
|
||||||
2. `build_scripts\win\common.py` - Variable named `VERSION_STRING`.
|
2. `build_scripts\win\common.py` - Variable named `VERSION_STRING`.
|
||||||
3. `installer\installer.nsi` - Variable named `VERSION_STRING`.
|
3. `installer\installer.nsi` - Variable named `VERSION_STRING`.
|
||||||
|
|
||||||
The first string should be three digits separated by dots (periods), as described in [semantic versioning](https://semver.org/) (like "2.8.0"). The second and third should be three digits separated by hyphens/dashes (like "2-8-0").
|
The string should be three digits separated by dots (periods), as described in [semantic versioning](https://semver.org/) (like "2.8.0"). Additional qualifiers may be appended with a dash (and only a dash). The `QMAKE` build script relies on there only being dot separated integers before the first dash. If there are non-integers (or letters) before the first dash the Windows build will fail.
|
||||||
|
|
||||||
The reason for the difference is that the first string is only used as a string in the source code, while the second and third are used to name files. Some operating system can become confused with more than one dot in the file name (like Windows). It's better to just avoid the situation entirely.
|
The AppVeyor build server will append the last 8 digits of the commit hash. This is in order to make debugging various versions easier. If `-release` is found in the original version string, `-release` will be removed and a hash will not be appended.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
!define THIRDDIR "..\third-party"
|
!define THIRDDIR "..\third-party"
|
||||||
!define PACKAGEDIR "..\src\package_files"
|
!define PACKAGEDIR "..\src\package_files"
|
||||||
!define PROJECTDIR "..\"
|
!define PROJECTDIR "..\"
|
||||||
!define VERSION_STRING "3-1-0-dev"
|
!define /file VERSION_STRING "..\build_scripts\compile_version_string.txt"
|
||||||
|
|
||||||
|
|
||||||
;Installer icon
|
;Installer icon
|
||||||
|
|||||||
@@ -48,7 +48,9 @@ constexpr auto applicationOrganizationName = "AdvancedSettings-Team";
|
|||||||
constexpr auto applicationName = "OpenVRAdvancedSettings";
|
constexpr auto applicationName = "OpenVRAdvancedSettings";
|
||||||
constexpr const char* applicationKey = "OVRAS-Team.AdvancedSettings";
|
constexpr const char* applicationKey = "OVRAS-Team.AdvancedSettings";
|
||||||
constexpr const char* applicationDisplayName = "Advanced Settings";
|
constexpr const char* applicationDisplayName = "Advanced Settings";
|
||||||
constexpr const char* applicationVersionString = "v3.1.0-dev";
|
|
||||||
|
constexpr const char* applicationVersionString = APPLICATION_VERSION;
|
||||||
|
|
||||||
} // namespace application_strings
|
} // namespace application_strings
|
||||||
|
|
||||||
// application namespace
|
// application namespace
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
IDI_ICON1 ICON DISCARDABLE "img/icons/advicon256px.ico"
|
|
||||||
Reference in New Issue
Block a user