summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-02-01 11:21:06 -0800
committerPaul Phillips <paulp@improving.org>2012-02-01 11:23:15 -0800
commitd01da30e4c2197ec24e29fb77ce9a62435bff9a4 (patch)
tree0fb5a16edf97e515cddef80441a16b1a4022ed2e /tools
parentc05b850cf5655943e861e0b898b253e83e0e094b (diff)
downloadscala-d01da30e4c2197ec24e29fb77ce9a62435bff9a4.tar.gz
scala-d01da30e4c2197ec24e29fb77ce9a62435bff9a4.tar.bz2
scala-d01da30e4c2197ec24e29fb77ce9a62435bff9a4.zip
Updated get-scala-revision to use git describe.
Hopefully this will satisfy all version-interesting parties. Version string now looks like this: v2.10.0-M1-0098-gbda61bb7e5-2012-02-01 Review by @dragos and anyone who uses windows (where it definitely won't produce that string, but hopefully it produces some usable string.)
Diffstat (limited to 'tools')
-rwxr-xr-xtools/get-scala-revision32
-rw-r--r--tools/get-scala-revision.bat2
2 files changed, 17 insertions, 17 deletions
diff --git a/tools/get-scala-revision b/tools/get-scala-revision
index b27b6ddc82..8d48c8cb78 100755
--- a/tools/get-scala-revision
+++ b/tools/get-scala-revision
@@ -2,23 +2,23 @@
#
# Usage: get-scala-revision [dir]
# Figures out current scala revision of a git clone.
-#
# If no dir is given, current working dir is used.
+#
+# Example build version string:
+# v2.10.0-M1-0098-g6f1c486d0b-2012-02-01
+#
+
+[[ $# -eq 0 ]] || cd "$1"
-# not like releases come out so often that we are duty-bound
-# to recalculate this every time.
-# git merge-base v2.8.2 v2.9.1 master
-devbase="df13e31bbb"
+# the closest tag, obtained separately because we have to
+# reconstruct the string around the padded distance.
+tag=$(git describe --abbrev=0)
-# reimplementing git describe hopefully in a way which works
-# without any particular tags, branches, or recent versions of git.
-# this is supposed to generate
-# dev-NNNN-g<sha>
-# where NNNN is the number of commits since devbase, which
-# is the merge-base of the most recent release and master.
-# Presently hardcoded to reduce uncertainty, v2.8.2/v2.9.1/master.
-commits=$(git --no-pager log --pretty=oneline $devbase..HEAD | wc -l)
-sha=$(git rev-list -n 1 HEAD)
-datestr=$(date "+%Y-%m-%d")
+# the full string - padding correctness depends on abbrev=10.
+described=$(git describe --abbrev=10 --always --tags)
-printf "rdev-%s-%s-g%s\n" $commits $datestr ${sha:0:7}
+# 016 is rocket-surgically-calibrated to pad the distance from the
+# tag to the current commit into a 4-digit number - since maven
+# will be treating this as a string, the ide depends on
+# 10 being greater than 9 (thus 0010 and 00009.)
+printf "%s-%016s-%s\n" "$tag" "${described##${tag}-}" $(date "+%Y-%m-%d")
diff --git a/tools/get-scala-revision.bat b/tools/get-scala-revision.bat
index f4dc24b71f..48c7cbd94f 100644
--- a/tools/get-scala-revision.bat
+++ b/tools/get-scala-revision.bat
@@ -15,7 +15,7 @@ if "%*"=="" (
cd %_DIR%
if exist .git\NUL (
- git describe HEAD --abbrev=7 --match dev
+ git describe --abbrev=10 --always --tags
)
:end