#!/usr/bin/env bash
# Return the complete revision number
# <major>.<minor>.<trunk-basis>.<patch-or-0>-<sha>[-qualifier]
set -e
version_template=`cat VERSION_TEMPLATE`
if [[ "$version_template" =~ ^[0-9]+\.[0-9]+\.GENERATED_VERSION(-[a-zA-Z0-9]+)?$ ]]; then
git_revision=`script/build/git_revision`
echo ${version_template/GENERATED_VERSION/$git_revision}
else
echo "Invalid version template string: $version_template" >&2
exit -1
fi