Update version scheme to match OpenRGB project

This commit is contained in:
Adam Honse 2025-01-20 22:21:08 -06:00
parent 5010ce5a0c
commit 3d61f0eff8
3 changed files with 52 additions and 12 deletions

View file

@ -3,7 +3,7 @@
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
variables: variables:
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
GIT_DEPTH: 1 GIT_DEPTH: 0
.shared_windows_runners: .shared_windows_runners:
tags: tags:

View file

@ -26,10 +26,43 @@ CONFIG +=
#-----------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------#
# Application Configuration # # Application Configuration #
#-----------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------#
MAJOR = 0 MAJOR = 0
MINOR = 9 MINOR = 9
REVISION = 1 SUFFIX = git
PLUGIN_VERSION = $$MAJOR"."$$MINOR$$REVISION
SHORTHASH = $$system("git rev-parse --short=7 HEAD")
LASTTAG = "release_"$$MAJOR"."$$MINOR
COMMAND = "git rev-list --count "$$LASTTAG"..HEAD"
COMMITS = $$system($$COMMAND)
VERSION_NUM = $$MAJOR"."$$MINOR"."$$COMMITS
VERSION_STR = $$MAJOR"."$$MINOR
VERSION_DEB = $$VERSION_NUM
VERSION_WIX = $$VERSION_NUM".0"
VERSION_AUR = $$VERSION_NUM
VERSION_RPM = $$VERSION_NUM
equals(SUFFIX, "git") {
VERSION_STR = $$VERSION_STR"+ ("$$SUFFIX$$COMMITS")"
VERSION_DEB = $$VERSION_DEB"~git"$$SHORTHASH
VERSION_AUR = $$VERSION_AUR".g"$$SHORTHASH
VERSION_RPM = $$VERSION_RPM"^git"$$SHORTHASH
} else {
!isEmpty(SUFFIX) {
VERSION_STR = $$VERSION_STR"+ ("$$SUFFIX")"
VERSION_DEB = $$VERSION_DEB"~"$$SUFFIX
VERSION_AUR = $$VERSION_AUR"."$$SUFFIX
VERSION_RPM = $$VERSION_RPM"^"$$SUFFIX
}
}
message("VERSION_NUM: "$$VERSION_NUM)
message("VERSION_STR: "$$VERSION_STR)
message("VERSION_DEB: "$$VERSION_DEB)
message("VERSION_WIX: "$$VERSION_WIX)
message("VERSION_AUR: "$$VERSION_AUR)
message("VERSION_RPM: "$$VERSION_RPM)
#-----------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------#
# Automatically generated build information # # Automatically generated build information #
@ -40,7 +73,7 @@ GIT_COMMIT_ID = $$system(git --git-dir $$_PRO_FILE_PWD_/.git --work-tree $$_PR
# Inject vars in defines # # Inject vars in defines #
#-----------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------#
DEFINES += \ DEFINES += \
VERSION_STRING=\\"\"\"$$PLUGIN_VERSION\\"\"\" \ VERSION_STRING=\\"\"\"$$VERSION_STR\\"\"\" \
GIT_COMMIT_ID=\\"\"\"$$GIT_COMMIT_ID\\"\"\" GIT_COMMIT_ID=\\"\"\"$$GIT_COMMIT_ID\\"\"\"
#-----------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------#

View file

@ -19,13 +19,20 @@ if [ -e ${1} ]; then
echo "Warning: File ${1} exists and will be overwritten" echo "Warning: File ${1} exists and will be overwritten"
fi fi
MAJOR=$(grep MAJOR\ ${PROJECT_FILE} | cut -d= -f 2 | tr -d [:space:]) VERSION_VAR="VERSION_NUM"
MINOR=$(grep MINOR\ ${PROJECT_FILE} | cut -d= -f 2 | tr -d [:space:]) QMAKE_EXE="qmake"
REVISION=$(grep REVISION\ ${PROJECT_FILE} | cut -d= -f 2 | tr -d [:space:])
#Convert Revision to a nummber in case it is blank in the project file if [[ ${1} == *"debian"* ]]; then
REVISION=$(( ${REVISION} + 0 )) VERSION_VAR="VERSION_DEB"
QMAKE_EXE="qmake"
fi
PACKAGE_VERSION="${MAJOR}.${MINOR}.${REVISION}" if [[ ${1} == *"fedora"* ]]; then
VERSION_VAR="VERSION_RPM"
QMAKE_EXE="qmake-qt5"
fi
PACKAGE_VERSION=$(${QMAKE_EXE} ${PROJECT_FILE} 2>&1 | grep ${VERSION_VAR} | cut -d ':' -f 3 | tr -d ' ')
echo $PACKAGE_VERSION
sed -e "s/${VERSION_PATTERN}/${PACKAGE_VERSION}/g" ${INFILE_PATH} > ${1} sed -e "s/${VERSION_PATTERN}/${PACKAGE_VERSION}/g" ${INFILE_PATH} > ${1}