summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Suereth <joshua.suereth@gmail.com>2012-03-19 10:28:45 -0400
committerJosh Suereth <joshua.suereth@gmail.com>2012-03-19 10:31:51 -0400
commit908636b5961fd14d91ac937d3306ea09f260cfa4 (patch)
treeb0d8eef42303cf44dea7512a19b41d90c34d12a5
parentf6c050e8cfa5bd1ee4bbb3434086d2ae2d35e5f7 (diff)
downloadscala-908636b5961fd14d91ac937d3306ea09f260cfa4.tar.gz
scala-908636b5961fd14d91ac937d3306ea09f260cfa4.tar.bz2
scala-908636b5961fd14d91ac937d3306ea09f260cfa4.zip
Fixed versioning scheme when running on a tag.
git describe is useless in that situation, afaict.
-rw-r--r--build.xml6
-rwxr-xr-xtools/get-scala-commit-drift31
-rwxr-xr-xtools/get-scala-commit-sha26
-rw-r--r--tools/get-scala-commit-sha.bat2
4 files changed, 12 insertions, 53 deletions
diff --git a/build.xml b/build.xml
index 53bd9c3011..b5a9931450 100644
--- a/build.xml
+++ b/build.xml
@@ -288,7 +288,9 @@ INITIALISATION
<exec osfamily="unix" executable="tools/get-scala-commit-drift" outputproperty="git.commit.drift" failifexecutionfails="false" />
<exec osfamily="windows" executable="tools/get-scala-commit-drift.bat" outputproperty="git.commit.drift" failifexecutionfails="false" />
<!-- some default in case something went wrong getting the revision -->
- <property name="git.describe" value="-unknown-"/>
+ <property name="git.commit.drift" value="00000000"/>
+ <property name="git.commit.sha" value="unknown"/>
+ <property name="git.commit.date" value="unknown"/>
<!-- We use the git describe to determine the OSGi modifier for our build. -->
<property
@@ -332,6 +334,8 @@ INITIALISATION
<echo message=" java args: ${env.ANT_OPTS} ${jvm.opts}" />
<echo message=" javac args: ${javac.args}" />
<echo message=" scalac args: ${scalac.args}" />
+ <echo message=" git hash: ${git.commit.sha}" />
+ <echo message=" git drift: ${git.commit.drift}" />
<echo message=" maven version: ${maven.version.number}"/>
<echo message=" OSGi version: ${osgi.version.number}" />
<echo message="canonical version: ${version.number}" />
diff --git a/tools/get-scala-commit-drift b/tools/get-scala-commit-drift
index 4959826ec1..1395c92c3d 100755
--- a/tools/get-scala-commit-drift
+++ b/tools/get-scala-commit-drift
@@ -11,30 +11,7 @@
[[ $# -eq 0 ]] || cd "$1"
-ensure_tag () {
- sha=$1
- rev=$2
-
- [[ -n $(git tag -l $rev) ]] || {
- git tag -a -m "generated by get-scala-revision" $rev $sha
- }
-}
-
-# Ensure some baseline tags are present so if this repository's
-# tags are screwed up or stale, we should still have a reference
-# point for a build string.
-ensure_tag 58cb15c40d v2.10.0-M1
-ensure_tag 29f3eace1e v2.9.1
-ensure_tag b0d78f6b9c v2.8.2
-
-# the closest tag, obtained separately because we have to
-# reconstruct the string around the padded distance.
-tag=$(git describe --tags --match 'v2*' --abbrev=0)
-
-# printf %016s is not portable for 0-padding, has to be a digit.
-# so we're stuck disassembling it.
-described=$(git describe --tags --match 'v2*' --abbrev=10)
-suffix="${described##${tag}-}"
-counter=$(echo $suffix | cut -d - -f 1)
-
-echo "$counter"
+# git describe is completely useles to us if we're on a tag, or haven't changed since then.
+# This at least gives us a total number of commits included in a release, which should grow steadily.
+counter=$(git shortlog | grep -E '^[ ]+\w+' | wc -l)
+printf "%08d" "$counter"
diff --git a/tools/get-scala-commit-sha b/tools/get-scala-commit-sha
index 0abe31a53c..eab90a4215 100755
--- a/tools/get-scala-commit-sha
+++ b/tools/get-scala-commit-sha
@@ -10,31 +10,9 @@
[[ $# -eq 0 ]] || cd "$1"
-ensure_tag () {
- sha=$1
- rev=$2
-
- [[ -n $(git tag -l $rev) ]] || {
- git tag -a -m "generated by get-scala-revision" $rev $sha
- }
-}
-
-# Ensure some baseline tags are present so if this repository's
-# tags are screwed up or stale, we should still have a reference
-# point for a build string.
-ensure_tag 58cb15c40d v2.10.0-M1
-ensure_tag 29f3eace1e v2.9.1
-ensure_tag b0d78f6b9c v2.8.2
-
-# the closest tag, obtained separately because we have to
-# reconstruct the string around the padded distance.
-tag=$(git describe --tags --match 'v2*' --abbrev=0)
-
# printf %016s is not portable for 0-padding, has to be a digit.
# so we're stuck disassembling it.
-described=$(git describe --tags --match 'v2*' --abbrev=10)
-suffix="${described##${tag}-}"
-hash=$(echo $suffix | cut -d - -f 2)
+hash=$(git log -1 --format="%H" HEAD)
hash=${hash#g}
-
+hash=${hash:0:10}
echo "$hash"
diff --git a/tools/get-scala-commit-sha.bat b/tools/get-scala-commit-sha.bat
index 80d9aa34b1..7a5afa11b1 100644
--- a/tools/get-scala-commit-sha.bat
+++ b/tools/get-scala-commit-sha.bat
@@ -15,7 +15,7 @@ if "%*"=="" (
cd %_DIR%
rem TODO - truncate chars.
-git log -1 --format="%T"
+git log -1 --format="%H
:end
@endlocal