Skip to content

Commit

Permalink
Use default fallback version if built outside of git repo (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
edenhill committed Apr 20, 2017
1 parent d6bf771 commit 0ab5204
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion configure.kafkacat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#

mkl_require good_cflags
mkl_require gitversion as KAFKACAT_VERSION
mkl_require gitversion as KAFKACAT_VERSION default 1.3.1


function checks {
Expand Down
16 changes: 13 additions & 3 deletions mklove/modules/configure.gitversion
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,24 @@
# VARIABLE_NAME
#
# Example: Set version in variable named "MYVERSION":
# mkl_require gitversion as MYVERSION
# mkl_require gitversion as MYVERSION [default DEFVERSION]

if [[ $1 == "as" ]]; then
__MKL_GITVERSION_VARNAME="$2"
shift
__MKL_GITVERSION_VARNAME="$1"
shift
else
__MKL_GITVERSION_VARNAME="VERSION"
fi

if [[ $1 == "default" ]]; then
shift
__MKL_GITVERSION_DEFAULT="$1"
shift
fi


function checks {
mkl_allvar_set "gitversion" "$__MKL_GITVERSION_VARNAME" "$(git describe --abbrev=6 --tags HEAD --always)"
mkl_allvar_set "gitversion" "$__MKL_GITVERSION_VARNAME" \
"$(git describe --abbrev=6 --tags HEAD --always 2>/dev/null || echo $__MKL_GITVERSION_DEFAULT)"
}

0 comments on commit 0ab5204

Please sign in to comment.