Commit a364e80a authored by Dominik Charousset's avatar Dominik Charousset

Drop complex Git logic from CMake

Fix get-release-version.sh and rely on the CI calling the script before
invoking CMake when building documentation.
parent 21f49437
*.DS_Store .make-release-steps.bash
Doxyfile Doxyfile
html/
build/*
cli_build/*
build-clang/*
build-gcc/*
Makefile Makefile
bin/* bin/*
lib/*
manual
*.swp
bii/*
.idea/
.ycm_extra_conf.pyc
blog_release_note.md blog_release_note.md
build/*
github_release_note.md github_release_note.md
.make-release-steps.bash html/*
*.swo manual
release.txt
...@@ -629,45 +629,11 @@ endif() ...@@ -629,45 +629,11 @@ endif()
# -- Fetch branch name and SHA if available ------------------------------------ # -- Fetch branch name and SHA if available ------------------------------------
if(EXISTS "release.txt") if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/release.txt")
file(READ "release.txt" CAF_VESION) file(READ "${CMAKE_CURRENT_SOURCE_DIR}/release.txt" CAF_RELEASE)
string(REGEX REPLACE "\n" "" CAF_RELEASE "${CAF_RELEASE}")
else() else()
set(CAF_RELEASE "${CAF_VERSION}") set(CAF_RELEASE "${CAF_VERSION}")
find_package(Git QUIET)
if(GIT_FOUND)
# retrieve current branch name for CAF
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE gitBranchResult
OUTPUT_VARIABLE gitBranch
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
# retrieve current SHA1 hash for CAF
execute_process(COMMAND ${GIT_EXECUTABLE} log --pretty=format:%h -n 1
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE gitShaResult
OUTPUT_VARIABLE gitSha
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(gitBranchResult EQUAL 0 AND gitShaResult EQUAL 0)
# generate semantic CAF version for manual
set(CAF_RELEASE "${CAF_VERSION}+exp.sha.${gitSha}")
# check whether we're building the manual for a stable release
if(gitBranch STREQUAL "master")
# retrieve current tag name for CAF
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --contains ${gitSha}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE gitTagResult
OUTPUT_VARIABLE gitTag
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
# tags indicate stable releases -> use tag name as release version
if(gitTagResult EQUAL 0)
set(CAF_RELEASE "${gitTag}")
endif()
endif()
endif()
endif()
endif() endif()
message(STATUS "Set release version for all documentation to ${CAF_RELEASE}.") message(STATUS "Set release version for all documentation to ${CAF_RELEASE}.")
......
#!/bin/sh #!/bin/sh
grep "define CAF_VERSION" libcaf_core/caf/config.hpp | awk '{printf "%d.%d.%d", int($3 / 10000), int($3 / 100) % 100, $3 % 100}' > version.txt # Get string representation of CAF version.
git log --pretty=format:%h -n 1 > sha.txt caf_version=`grep "define CAF_VERSION" libcaf_core/caf/config.hpp | awk '{ printf "%d.%d.%d", int($3 / 10000), int($3 / 100) % 100, $3 % 100 }'`
if test "$(cat branch.txt) = master" && git describe --tags --contains $(cat sha.txt) 1>tag.txt 2>/dev/null ; then
cp tag.txt release.txt # Get SHA from Git.
else git_sha=`git log --pretty=format:%h -n 1`
printf "%s" "$(cat version.txt)+exp.sha.$(cat sha.txt)" > release.txt
# Check whether the current SHA is a tag.
if git describe --tags --contains $git_sha 1>release.txt 2>/dev/null
then
# Tags indicate stable release -> use tag version.
# On success, we'll have the tag version in release.txt now, so we're done.
exit 0
fi fi
# Generate default release version.
echo "$caf_version+exp.sha.$git_sha" >release.txt
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment