Skip to content

Commit

Permalink
Allow KeePassXC version overrides from file in addition to Git tags
Browse files Browse the repository at this point in the history
  • Loading branch information
phoerious committed Feb 22, 2018
1 parent 69283e8 commit 3089894
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ release*/
*.swp

.DS_Store
.version
17 changes: 10 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,22 @@ set_property(CACHE KEEPASSXC_BUILD_TYPE PROPERTY STRINGS Snapshot Release PreRel
execute_process(COMMAND git tag --points-at HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_TAG)
if(GIT_TAG)
string(REGEX REPLACE "\r?\n$" "" GIT_TAG "${GIT_TAG}")
if(NOT GIT_TAG AND EXISTS ${CMAKE_SOURCE_DIR}/.version)
file(READ ${CMAKE_SOURCE_DIR}/.version OVERRIDE_VERSION)
endif()

if(GIT_TAG MATCHES "^[\\.0-9]+-(alpha|beta)[0-9]+$")
string(REGEX REPLACE "(\r?\n)+" "" OVERRIDE_VERSION "${OVERRIDE_VERSION}")
if(OVERRIDE_VERSION)
if(OVERRIDE_VERSION MATCHES "^[\\.0-9]+-(alpha|beta)[0-9]+$")
set(KEEPASSXC_BUILD_TYPE PreRelease)
set(KEEPASSXC_VERSION ${GIT_TAG})
elseif(GIT_TAG MATCHES "^[\\.0-9]+$")
set(KEEPASSXC_VERSION ${OVERRIDE_VERSION})
elseif(OVERRIDE_VERSION MATCHES "^[\\.0-9]+$")
set(KEEPASSXC_BUILD_TYPE Release)
set(KEEPASSXC_VERSION ${GIT_TAG})
set(KEEPASSXC_VERSION ${OVERRIDE_VERSION})
endif()
endif()

if(KEEPASSXC_BUILD_TYPE STREQUAL "PreRelease" AND NOT GIT_TAG)
if(KEEPASSXC_BUILD_TYPE STREQUAL "PreRelease" AND NOT OVERRIDE_VERSION)
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-preview")
elseif(KEEPASSXC_BUILD_TYPE STREQUAL "Snapshot")
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-snapshot")
Expand Down

0 comments on commit 3089894

Please sign in to comment.