From e91c22d20a244b91228fd294e473dcfb8c5383c7 Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 16:50:58 +0200 Subject: [PATCH 01/22] Change NSIS to look in file for version string --- build_scripts/compile_version_string.txt | 1 + installer/installer.nsi | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 build_scripts/compile_version_string.txt diff --git a/build_scripts/compile_version_string.txt b/build_scripts/compile_version_string.txt new file mode 100644 index 0000000..3b0338f --- /dev/null +++ b/build_scripts/compile_version_string.txt @@ -0,0 +1 @@ +3.1.0-dev-new \ No newline at end of file diff --git a/installer/installer.nsi b/installer/installer.nsi index c7e0264..69d5fd9 100644 --- a/installer/installer.nsi +++ b/installer/installer.nsi @@ -11,7 +11,7 @@ !define THIRDDIR "..\third-party" !define PACKAGEDIR "..\src\package_files" !define PROJECTDIR "..\" - !define VERSION_STRING "3-1-0-dev" + !define /file VERSION_STRING "..\build_scripts\compile_version_string.txt" ;Installer icon From cd1522b9e2f5cc0a44bf2ae140391eba8e49d68f Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 17:11:51 +0200 Subject: [PATCH 02/22] Make windows build scripts read file for version number --- build_scripts/win/common.py | 101 +++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 48 deletions(-) diff --git a/build_scripts/win/common.py b/build_scripts/win/common.py index 3457895..2057909 100644 --- a/build_scripts/win/common.py +++ b/build_scripts/win/common.py @@ -8,10 +8,15 @@ import subprocess import shutil 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 -#Version string must be bumped every release. -#TODO: See developer documentation. -VERSION_STRING = "3-1-0-dev" +VERSION_STRING = get_version_string() EXIT_CODE_SUCCESS = 0 EXIT_CODE_FAILURE_BUILD_APP = 1 @@ -62,17 +67,17 @@ def say(message: str): """ global current_activity print(current_activity + ": " + message) - + def say_error(message: str): """ Prints an error message to the console. - - Not currently different from say, but put in incase somebody wanted to + + Not currently different from say, but put in incase somebody wanted to do something fancy with outputting to stderr or something instead. """ global current_activity - print(current_activity + ": " + message) - + print(current_activity + ": " + message) + def is_env_var_set(env_var_name: str): """ Returns whether or not an environment variable is set. @@ -81,7 +86,7 @@ def is_env_var_set(env_var_name: str): if var is None: return False return True - + def add_line_to_run_bat_file(line: str): """ Adds a line ended by a newline to the batch file. @@ -92,7 +97,7 @@ def add_line_to_run_bat_file(line: str): def add_error_handling_line_to_bat_file(): """ Adds an error handling line to the batch file. - + This is because some applications don't cause the script to error out even if they exit with an error. """ @@ -117,23 +122,23 @@ def get_required_env_var_path(env_var_name: str, default_env_var_value: str): exit_on_error(EXIT_CODE_FAILURE_BUILD_LOCATION) say(f"{env_var_name} exists.") return path - + def create_batch_file(): """ Creates a batch file in the dir. Must be called by another outside batch file. """ file = open(get_project_dir() + "\\build_scripts\\win\\current_build.bat", "w+") file.write(bat_file_contents) - file.close() + file.close() def exit_on_error(error_number): """Wrapper around sys.exit.""" sys.exit(error_number) - + def set_dirs(): """ Sets up the directories. - + We know that the project dir will always be two dirs up from the dir the file is in. """ global ORIGINAL_DIR @@ -142,50 +147,50 @@ def set_dirs(): ORIGINAL_DIR = os.path.dirname(__file__) PROJECT_DIR = os.path.abspath(os.path.join(ORIGINAL_DIR, r"..\..")) DEPLOY_DIR = DEPLOY_DIR = PROJECT_DIR + OUTPUT_DIR - + print(ORIGINAL_DIR) - + def get_project_dir(): return PROJECT_DIR - + def get_original_dir(): - return ORIGINAL_DIR - + return ORIGINAL_DIR + def get_deploy_dir(): return DEPLOY_DIR - + def copy_file(src, dest): """Copies a file and outputs status to console.""" say(f"Copying {src} to {dest}") shutil.copy(src, dest) - say(f"{src} to {dest} copied.") - + say(f"{src} to {dest} copied.") + def copy_folder(src, dest): """Copies a folder and outputs status to console.""" say(f"Copying {src} to {dest}") - distutils.dir_util.copy_tree(src, dest) - say(f"{src} to {dest} copied.") - - - - - - - - - - - - - - - - - - - - - - - - + distutils.dir_util.copy_tree(src, dest) + say(f"{src} to {dest} copied.") + + + + + + + + + + + + + + + + + + + + + + + + From 6cf009e9157fc2ca993ffa5a4b19beace12efb0f Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 17:12:54 +0200 Subject: [PATCH 03/22] Convert C++ code to read version string from file This is definitely not a pretty thing. Double quotes are required around the string which means they'll need to be removed in the NSIS and Python scripts. --- build_scripts/compile_version_string.txt | 2 +- src/overlaycontroller.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build_scripts/compile_version_string.txt b/build_scripts/compile_version_string.txt index 3b0338f..7107992 100644 --- a/build_scripts/compile_version_string.txt +++ b/build_scripts/compile_version_string.txt @@ -1 +1 @@ -3.1.0-dev-new \ No newline at end of file +"3.1.0-dev-new" \ No newline at end of file diff --git a/src/overlaycontroller.h b/src/overlaycontroller.h index d515fb8..24b2fa7 100644 --- a/src/overlaycontroller.h +++ b/src/overlaycontroller.h @@ -48,7 +48,10 @@ constexpr auto applicationOrganizationName = "AdvancedSettings-Team"; constexpr auto applicationName = "OpenVRAdvancedSettings"; constexpr const char* applicationKey = "OVRAS-Team.AdvancedSettings"; constexpr const char* applicationDisplayName = "Advanced Settings"; -constexpr const char* applicationVersionString = "v3.1.0-dev"; +constexpr const char* applicationVersionString = { +#include "../build_scripts/compile_version_string.txt" +}; + } // namespace application_strings // application namespace From a74f0cad49fbce42785136f9a0bb3e9742a80264 Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 17:22:08 +0200 Subject: [PATCH 04/22] Make NSIS and Win build scripts remove " character It is not strictly necessary in the Python version because it's being appended to a batch command, but in order to have things make sense if the mechanism of dispatching commands changes the program will strip double quotes. --- build_scripts/win/common.py | 2 +- installer/installer.nsi | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build_scripts/win/common.py b/build_scripts/win/common.py index 2057909..7b3ae9a 100644 --- a/build_scripts/win/common.py +++ b/build_scripts/win/common.py @@ -12,7 +12,7 @@ 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 + return contents.strip('"') #Const globals diff --git a/installer/installer.nsi b/installer/installer.nsi index 69d5fd9..7303aea 100644 --- a/installer/installer.nsi +++ b/installer/installer.nsi @@ -11,7 +11,8 @@ !define THIRDDIR "..\third-party" !define PACKAGEDIR "..\src\package_files" !define PROJECTDIR "..\" - !define /file VERSION_STRING "..\build_scripts\compile_version_string.txt" + !define /file VERSION_STRING_QUOTES "..\build_scripts\compile_version_string.txt" + !searchreplace VERSION_STRING ${VERSION_STRING_QUOTES} "$\"" "" ;Installer icon From 9303d93f2764b20902a998b47f444fc4ae0318eb Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 18:08:49 +0200 Subject: [PATCH 05/22] Make appveyor able to inject git commit into version --- .appveyor.yml | 1 + build_scripts/append_to_version_file.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 build_scripts/append_to_version_file.py diff --git a/.appveyor.yml b/.appveyor.yml index 2b84678..bda5076 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -26,6 +26,7 @@ clone_depth: 1 init: - set TAG_NAME=%APPVEYOR_REPO_TAG_NAME% + - python ./build_scripts/append_to_version_file.py $(APPVEYOR_REPO_COMMIT) > ./build_scripts/compile_version_string.txt build_script: - python ./build_scripts/run-clang-format.py ./src -r --clang-format-executable "C:\Program Files\LLVM\bin\clang-format.exe" --color always diff --git a/build_scripts/append_to_version_file.py b/build_scripts/append_to_version_file.py new file mode 100644 index 0000000..a766322 --- /dev/null +++ b/build_scripts/append_to_version_file.py @@ -0,0 +1,13 @@ +from sys import argv +from os import path + +def get_version_string(): + dir_path = path.dirname(path.realpath(__file__)) + with open(dir_path + "/compile_version_string.txt", "r") as file: + contents = file.readline() + return contents.strip('"') + +if __name__ == "__main__": + current_version = get_version_string() + new_version = current_version + "-" + argv[1] + print("\"" + new_version + "\"") \ No newline at end of file From af98c357fc5f584f3334d8e396b907f571a1563a Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 18:16:00 +0200 Subject: [PATCH 06/22] Add version number to start of build script --- build_scripts/win/build.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build_scripts/win/build.py b/build_scripts/win/build.py index a1d8a21..2a15d55 100644 --- a/build_scripts/win/build.py +++ b/build_scripts/win/build.py @@ -154,6 +154,8 @@ def build(): COMPILE_MODE = "" COMPILER = "" + say("Attempting to build version: " + VERSION_STRING) + say("Testing if all required build environment variables are set:") 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) From 4e781fa74aa60d5fddc7880aa8baf559aa5401a0 Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 18:23:40 +0200 Subject: [PATCH 07/22] Make append version file more cross platform --- build_scripts/append_to_version_file.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build_scripts/append_to_version_file.py b/build_scripts/append_to_version_file.py index a766322..30d9f40 100644 --- a/build_scripts/append_to_version_file.py +++ b/build_scripts/append_to_version_file.py @@ -1,9 +1,10 @@ +#!/usr/bin/env python from sys import argv from os import path def get_version_string(): dir_path = path.dirname(path.realpath(__file__)) - with open(dir_path + "/compile_version_string.txt", "r") as file: + with open(path.join(dir_path, "compile_version_string.txt"), "r") as file: contents = file.readline() return contents.strip('"') From 72a319bc1edb34226c706ad29f12aff9a92adc3f Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 18:33:29 +0200 Subject: [PATCH 08/22] Make Python replace version file responsible for file writes While the initial idea of having cmd/PS/bash actually write the changes to file, the integration with the AppVeyor YAML just made it really frustrating. --- .appveyor.yml | 2 +- build_scripts/append_to_version_file.py | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index bda5076..f4dcbb0 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -26,7 +26,7 @@ clone_depth: 1 init: - set TAG_NAME=%APPVEYOR_REPO_TAG_NAME% - - python ./build_scripts/append_to_version_file.py $(APPVEYOR_REPO_COMMIT) > ./build_scripts/compile_version_string.txt + - python ./build_scripts/append_to_version_file.py %APPVEYOR_REPO_COMMIT% build_script: - python ./build_scripts/run-clang-format.py ./src -r --clang-format-executable "C:\Program Files\LLVM\bin\clang-format.exe" --color always diff --git a/build_scripts/append_to_version_file.py b/build_scripts/append_to_version_file.py index 30d9f40..c1ddb60 100644 --- a/build_scripts/append_to_version_file.py +++ b/build_scripts/append_to_version_file.py @@ -1,14 +1,21 @@ #!/usr/bin/env python from sys import argv -from os import path +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(): - dir_path = path.dirname(path.realpath(__file__)) - with open(path.join(dir_path, "compile_version_string.txt"), "r") as file: + 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) + if __name__ == "__main__": current_version = get_version_string() new_version = current_version + "-" + argv[1] - print("\"" + new_version + "\"") \ No newline at end of file + set_version_string(new_version) \ No newline at end of file From 3d13c683034f19f594b079d9eb257c15307944e7 Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 18:44:38 +0200 Subject: [PATCH 09/22] Move AppVeyor version string script to build section It does not work in the init section for some reason, with python giving python .\\build_scripts\\append_to_version_file.py %APPVEYOR_REPO_COMMIT% python: can't open file '.\\build_scripts\\append_to_version_file.py': [Errno 2] No such file or directory --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index f4dcbb0..ec33e2c 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -26,9 +26,9 @@ clone_depth: 1 init: - set TAG_NAME=%APPVEYOR_REPO_TAG_NAME% - - python ./build_scripts/append_to_version_file.py %APPVEYOR_REPO_COMMIT% build_script: + - python ./build_scripts/append_to_version_file.py %APPVEYOR_REPO_COMMIT% - 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" From 0ec39f77147f478a317374d6f3de1152d0507590 Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 18:51:00 +0200 Subject: [PATCH 10/22] Add double quotes around new version string --- build_scripts/append_to_version_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_scripts/append_to_version_file.py b/build_scripts/append_to_version_file.py index c1ddb60..77685c5 100644 --- a/build_scripts/append_to_version_file.py +++ b/build_scripts/append_to_version_file.py @@ -13,7 +13,7 @@ def get_version_string(): def set_version_string(new_version_string): remove(version_file_path) with open(version_file_path, "w") as file: - file.write(new_version_string) + file.write("\"" + new_version_string + "\"") if __name__ == "__main__": current_version = get_version_string() From 5eea5d7e9371ecb570bb3b6931d6b33b035d0766 Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 18:52:09 +0200 Subject: [PATCH 11/22] Make AppVeyor only use last 8 digits of hash --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index ec33e2c..d81fbb5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -28,7 +28,7 @@ init: - set TAG_NAME=%APPVEYOR_REPO_TAG_NAME% build_script: - - python ./build_scripts/append_to_version_file.py %APPVEYOR_REPO_COMMIT% + - python ./build_scripts/append_to_version_file.py %APPVEYOR_REPO_COMMIT:~-8% - 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" From c36dd70f60c8750745d43123af22ee78b45dd765 Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 18:56:11 +0200 Subject: [PATCH 12/22] Change build metadata separator from - to + SemVer 2.0.0 requires a plus for build metadata. https://semver.org/ `Build metadata MAY be denoted by appending a plus sign and a series of dot separated identifiers immediately following the patch or pre-release version. Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Build metadata SHOULD be ignored when determining version precedence. Thus two versions that differ only in the build metadata, have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700, 1.0.0-beta+exp.sha.5114f85.` --- build_scripts/append_to_version_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_scripts/append_to_version_file.py b/build_scripts/append_to_version_file.py index 77685c5..3705fe8 100644 --- a/build_scripts/append_to_version_file.py +++ b/build_scripts/append_to_version_file.py @@ -17,5 +17,5 @@ def set_version_string(new_version_string): if __name__ == "__main__": current_version = get_version_string() - new_version = current_version + "-" + argv[1] + new_version = current_version + "+" + argv[1] set_version_string(new_version) \ No newline at end of file From 5c4e8a34861d656c5118e6bfd1cfea0baffc1f20 Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 19:05:02 +0200 Subject: [PATCH 13/22] Make version append script respect release builds Users do not care about commit numbers and it only serves to confuse them. Release builds should not contain build metadata since there should only be one definitive version. --- build_scripts/append_to_version_file.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/build_scripts/append_to_version_file.py b/build_scripts/append_to_version_file.py index 3705fe8..99d33ef 100644 --- a/build_scripts/append_to_version_file.py +++ b/build_scripts/append_to_version_file.py @@ -8,14 +8,21 @@ 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('"') + 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 + "\"") -if __name__ == "__main__": +def main(): current_version = get_version_string() - new_version = current_version + "+" + argv[1] - set_version_string(new_version) \ No newline at end of file + 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() From 9bebfe306736380e076bbe9ecc451886ed9c909b Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 19:07:01 +0200 Subject: [PATCH 14/22] Add build directory to .gitignore The Linux build process creates this directory and uses it. It should not be committed. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a8a664c..66cc3e3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ debug release assets bin +build Makefile* *.vcxproj* *.log From 164158330ee2631a86e42f4a425873472f5d2333 Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 19:35:35 +0200 Subject: [PATCH 15/22] Convert C++ version string to be define instead of include This allows Qmake to use the version number as well as not requiring all other uses of the version string to strip double quotes from it. This also reduces the fragility of the version string as it was required to be a valid C++ char*, even in contexts where that wouldn't matter. --- advancedSettings.pro | 3 +++ build_scripts/append_to_version_file.py | 2 +- build_scripts/compile_version_string.txt | 2 +- build_scripts/win/common.py | 2 +- installer/installer.nsi | 3 +-- src/overlaycontroller.h | 5 ++--- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/advancedSettings.pro b/advancedSettings.pro index 4396480..2d4e754 100644 --- a/advancedSettings.pro +++ b/advancedSettings.pro @@ -3,6 +3,9 @@ CONFIG += c++1z 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\\\" + lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5.12 or higher") lessThan(QT_MINOR_VERSION, 12): error("requires Qt 5.12 or higher") diff --git a/build_scripts/append_to_version_file.py b/build_scripts/append_to_version_file.py index 99d33ef..33d2906 100644 --- a/build_scripts/append_to_version_file.py +++ b/build_scripts/append_to_version_file.py @@ -13,7 +13,7 @@ def get_version_string(): def set_version_string(new_version_string): remove(version_file_path) with open(version_file_path, "w") as file: - file.write("\"" + new_version_string + "\"") + file.write(new_version_string) def main(): current_version = get_version_string() diff --git a/build_scripts/compile_version_string.txt b/build_scripts/compile_version_string.txt index 7107992..3b0338f 100644 --- a/build_scripts/compile_version_string.txt +++ b/build_scripts/compile_version_string.txt @@ -1 +1 @@ -"3.1.0-dev-new" \ No newline at end of file +3.1.0-dev-new \ No newline at end of file diff --git a/build_scripts/win/common.py b/build_scripts/win/common.py index 7b3ae9a..2057909 100644 --- a/build_scripts/win/common.py +++ b/build_scripts/win/common.py @@ -12,7 +12,7 @@ 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.strip('"') + return contents #Const globals diff --git a/installer/installer.nsi b/installer/installer.nsi index 7303aea..69d5fd9 100644 --- a/installer/installer.nsi +++ b/installer/installer.nsi @@ -11,8 +11,7 @@ !define THIRDDIR "..\third-party" !define PACKAGEDIR "..\src\package_files" !define PROJECTDIR "..\" - !define /file VERSION_STRING_QUOTES "..\build_scripts\compile_version_string.txt" - !searchreplace VERSION_STRING ${VERSION_STRING_QUOTES} "$\"" "" + !define /file VERSION_STRING "..\build_scripts\compile_version_string.txt" ;Installer icon diff --git a/src/overlaycontroller.h b/src/overlaycontroller.h index 24b2fa7..a33119b 100644 --- a/src/overlaycontroller.h +++ b/src/overlaycontroller.h @@ -48,9 +48,8 @@ constexpr auto applicationOrganizationName = "AdvancedSettings-Team"; constexpr auto applicationName = "OpenVRAdvancedSettings"; constexpr const char* applicationKey = "OVRAS-Team.AdvancedSettings"; constexpr const char* applicationDisplayName = "Advanced Settings"; -constexpr const char* applicationVersionString = { -#include "../build_scripts/compile_version_string.txt" -}; + +constexpr const char* applicationVersionString = APPLICATION_VERSION; } // namespace application_strings From bb1d3e16fb3c85e1025566ccfb0a98e13bc134c4 Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 21:36:40 +0200 Subject: [PATCH 16/22] Convert executable icon to new method Manually creating an RC file was the Qt 4 way. The Qt 5 way is just giving it an icon. When an RC_FILE isn't manually created Qt will attempt to create one. If there are non-integers in the version number the compilation will crash. AdvancedSettings_resource.rc is a build artifact on Windows. --- .gitignore | 3 ++- advancedSettings.pro | 5 +++++ build_scripts/qt/resources.pri | 2 +- src/res/icon.rc | 1 - 4 files changed, 8 insertions(+), 3 deletions(-) delete mode 100644 src/res/icon.rc diff --git a/.gitignore b/.gitignore index 66cc3e3..83a7908 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ Makefile* installer/*.exe *.user* build_scripts/win/__pycache__ -build_scripts/win/current_build.bat \ No newline at end of file +build_scripts/win/current_build.bat +AdvancedSettings_resource.rc diff --git a/advancedSettings.pro b/advancedSettings.pro index 2d4e754..d53dd70 100644 --- a/advancedSettings.pro +++ b/advancedSettings.pro @@ -5,6 +5,11 @@ 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 lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5.12 or higher") lessThan(QT_MINOR_VERSION, 12): error("requires Qt 5.12 or higher") diff --git a/build_scripts/qt/resources.pri b/build_scripts/qt/resources.pri index f0c32c9..7cf19f4 100644 --- a/build_scripts/qt/resources.pri +++ b/build_scripts/qt/resources.pri @@ -47,4 +47,4 @@ DISTFILES += \ src/res/qml/desktop_overlay_page/translation_back_forwards/SteamDesktopTranslationBackForwards.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 diff --git a/src/res/icon.rc b/src/res/icon.rc deleted file mode 100644 index c1f36c5..0000000 --- a/src/res/icon.rc +++ /dev/null @@ -1 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "img/icons/advicon256px.ico" \ No newline at end of file From 4450b9b38aa13b993200e540ef8c878d64b6aa52 Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 22:10:05 +0200 Subject: [PATCH 17/22] Add version number to Windows exe file description The "real" version number doesn't accept non-integers. This should make debugging easier. --- advancedSettings.pro | 3 +++ 1 file changed, 3 insertions(+) diff --git a/advancedSettings.pro b/advancedSettings.pro index d53dd70..2b13e11 100644 --- a/advancedSettings.pro +++ b/advancedSettings.pro @@ -11,6 +11,9 @@ 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_MINOR_VERSION, 12): error("requires Qt 5.12 or higher") From 0e8e26d553403b8b73532c952f1e6c742c1d1c98 Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 22:14:11 +0200 Subject: [PATCH 18/22] Change version name to 3.1.0-dev The previous -new appendix was just to make sure the old name wasn't being used instead. --- build_scripts/compile_version_string.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_scripts/compile_version_string.txt b/build_scripts/compile_version_string.txt index 3b0338f..fee2d3e 100644 --- a/build_scripts/compile_version_string.txt +++ b/build_scripts/compile_version_string.txt @@ -1 +1 @@ -3.1.0-dev-new \ No newline at end of file +3.1.0-dev \ No newline at end of file From 13b3ba7a56c759b0d35272b35d861f1e991142c1 Mon Sep 17 00:00:00 2001 From: Vasily Date: Fri, 19 Apr 2019 22:23:04 +0200 Subject: [PATCH 19/22] Update docs on version numbers for new system --- docs/developer_docs.md | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/docs/developer_docs.md b/docs/developer_docs.md index c7e2f02..beb2340 100644 --- a/docs/developer_docs.md +++ b/docs/developer_docs.md @@ -1,23 +1,17 @@ - # OpenVR Advanced Settings Developer Docs For things that don't directly belong a single place in the source code. - > * [New Patch Release Checklist](#patch_checklist) - > * [Increment Version Numbers](#inc_vers_numbers) +# New Patch Release Checklist - -## New Patch Release Checklist +## Increment Version Numbers - -### Increment Version Numbers +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. -Currently there are three version strings in the source. - -1. `src\overlaycontroller.h` - Variable named `applicationVersionString`. +1. `advancedSettings.pro` - `VERSION` variable and `APPLICATION_VERSION` define. 2. `build_scripts\win\common.py` - 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. \ No newline at end of file +The AppVeyor build server will append the last 8 digits of the commit hash. This is in order to make debugging various versions easier. From 7bf53cf081c44fc747648a6f22673809cb90c639 Mon Sep 17 00:00:00 2001 From: Vasily Date: Sat, 20 Apr 2019 08:57:36 +0200 Subject: [PATCH 20/22] Add more documentation on version strings --- docs/developer_docs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/developer_docs.md b/docs/developer_docs.md index beb2340..7c3cff2 100644 --- a/docs/developer_docs.md +++ b/docs/developer_docs.md @@ -14,4 +14,4 @@ The version number string is kept in the `./build_scripts/compile_version_string 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 AppVeyor build server will append the last 8 digits of the commit hash. This is in order to make debugging various versions easier. +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, a hash will not be appended. From b4e7b4cc8de177a7c2bdb8c5e7536a94bec38157 Mon Sep 17 00:00:00 2001 From: Vasily Date: Sat, 20 Apr 2019 09:12:56 +0200 Subject: [PATCH 21/22] Change version hash suffix to be first 8 characters Github shows the first 8 instead of the last 8, this will make comparison easier. --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index d81fbb5..4e3a0af 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -28,7 +28,7 @@ init: - set TAG_NAME=%APPVEYOR_REPO_TAG_NAME% build_script: - - python ./build_scripts/append_to_version_file.py %APPVEYOR_REPO_COMMIT:~-8% + - 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 - call "build_windows.cmd" From 78d715ed4ccac83e063ef1293d9dc17ba8dc8c24 Mon Sep 17 00:00:00 2001 From: Vasily Date: Sat, 20 Apr 2019 09:52:18 +0200 Subject: [PATCH 22/22] Update documentation for version strings --- docs/developer_docs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/developer_docs.md b/docs/developer_docs.md index 7c3cff2..af725ce 100644 --- a/docs/developer_docs.md +++ b/docs/developer_docs.md @@ -14,4 +14,4 @@ The version number string is kept in the `./build_scripts/compile_version_string 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 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, a hash will not be appended. +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.