aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/bootstrap
diff options
context:
space:
mode:
authorGravatar Damien Martin-Guillerez <dmarting@google.com>2016-03-14 11:01:31 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-03-14 13:54:38 +0000
commit28e67b5e929824553ab80de8d37288a684b00008 (patch)
tree1f06ccc21835a467c2159488999fe38cf2ba9abb /scripts/bootstrap
parent9f2c4f7bc8f1b0397886b836f53d783ff6dada37 (diff)
Add the last Bazel version number to ./compile.sh
All Bazel should now contain the latest version with a date modifier to ensure we can track all Bazel builds out there. It is especially important for #1014. -- Change-Id: I8d17d9e1660b104c2b8623d5a8a06d010d044ea7 Reviewed-on: https://bazel-review.googlesource.com/3070 MOS_MIGRATED_REVID=117120584
Diffstat (limited to 'scripts/bootstrap')
-rwxr-xr-xscripts/bootstrap/buildenv.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/bootstrap/buildenv.sh b/scripts/bootstrap/buildenv.sh
index 98eacf7a26..3b7956c271 100755
--- a/scripts/bootstrap/buildenv.sh
+++ b/scripts/bootstrap/buildenv.sh
@@ -182,6 +182,27 @@ function git_sha1() {
fi
}
+function git_date() {
+ if [ -x "$(which git || true)" ] && [ -d .git ]; then
+ git log -1 --pretty=%ai | cut -d " " -f 1 || true
+ fi
+}
+
+# Get the latest release version and append the date of
+# the last commit if any.
+function get_last_version() {
+ local version="$(fgrep -m 1 '## Release' CHANGELOG.md \
+ | sed -E 's|.*Release (.*) \(.*\)|\1|')"
+ local date="$(git_date)"
+ if [ -z "${version-}" ]; then
+ version="unknown"
+ fi
+ if [ -n "${date-}" ]; then
+ date="$(date +%Y-%m-%d)"
+ fi
+ echo "${version}-${date}"
+}
+
if [[ ${PLATFORM} == "darwin" ]]; then
function md5_file() {
echo $(cat $1 | md5) $1