diff options
author | Paul Phillips <paulp@improving.org> | 2011-12-02 05:36:03 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-12-04 17:20:50 -0800 |
commit | a289465c70630719cbd3a74edf5502a156ef83c4 (patch) | |
tree | c1c5d6add5b0c9d4e8d94b6b8f3456245ae4576b | |
parent | a17908694b89115026f587bcb8a8ed6d16768cad (diff) | |
download | scala-a289465c70630719cbd3a74edf5502a156ef83c4.tar.gz scala-a289465c70630719cbd3a74edf5502a156ef83c4.tar.bz2 scala-a289465c70630719cbd3a74edf5502a156ef83c4.zip |
Use git-describe to create build string.
Created dev tag which is the merge-base of master and 2.9.1 (merge-base
is the last common commit), and told ant to generate build strings based
on that. So distributions look like
scala-2.10.0.dev-1289-gbba3918
Where the 1289 means you are 1289 commits ahead of "dev" and
the last segment (minus the g) is the sha-1 hash.
This no doubt breaks windows even further. Help getting it
back on its feet greatly appreciated.
-rw-r--r-- | build.xml | 11 | ||||
-rwxr-xr-x | tools/get-scala-revision | 28 | ||||
-rw-r--r-- | tools/get-scala-revision.bat | 27 |
3 files changed, 15 insertions, 51 deletions
@@ -232,10 +232,10 @@ INITIALISATION <os family="windows"/> </condition> - <exec osfamily="unix" executable="tools/get-scala-revision" outputproperty="svn.number" failifexecutionfails="false" /> - <exec osfamily="windows" executable="tools/get-scala-revision.bat" outputproperty="svn.number" failifexecutionfails="false" /> + <exec osfamily="unix" executable="tools/get-scala-revision" outputproperty="git.describe" failifexecutionfails="false" /> + <exec osfamily="windows" executable="tools/get-scala-revision.bat" outputproperty="git.describe" failifexecutionfails="false" /> <!-- some default in case something went wrong getting the revision --> - <property name="svn.number" value="0"/> + <property name="git.describe" value="-unknown-"/> <property name="init.avail" value="yes"/> @@ -243,10 +243,11 @@ INITIALISATION <property file="${basedir}/build.number"/> <property name="version.number" - value="${version.major}.${version.minor}.${version.patch}.r${svn.number}-b${time.short}"/> + value="${version.major}.${version.minor}.${version.patch}.${git.describe}"/> + <!-- And print-out what we are building --> <echo level="info" message="Build number is '${version.number}'"/> - <echo level="info" message="Built ${time.human} from revision ${svn.number} with ${java.vm.name} ${java.version}"/> + <echo level="info" message="Built ${time.human} from revision ${git.describe} with ${java.vm.name} ${java.version}"/> <!-- Local libs (developer use.) --> <mkdir dir="${lib-extra.dir}"/> diff --git a/tools/get-scala-revision b/tools/get-scala-revision index 8731705d06..23b216aa2b 100755 --- a/tools/get-scala-revision +++ b/tools/get-scala-revision @@ -1,30 +1,12 @@ #!/bin/sh # # Usage: get-scala-revision [dir] -# Figures out current scala revision of an svn checkout or -# a git-svn mirror (or a git clone.) +# Figures out current scala revision of a git clone. # # If no dir is given, current working dir is used. -DIR="" -if [ $# -eq 0 ]; then - DIR=`pwd` -else - DIR=$1 -fi +[[ -n "$1" ]] && cd "$1" -cd $DIR - -if [ -d .svn ]; then - # 2>&1 to catch also error output (e.g. svn warnings) - svn info . 2>&1 | grep ^Revision | sed 's/Revision: //' -elif [ -d .git ]; then - GIT_PAGER=cat - # this grabs more than one line because otherwise if you have local - # commits which aren't in git-svn it won't see any revision. - git log -10 | grep git-svn-id | head -1 | sed 's/[^@]*@\([0-9]*\).*/\1/' -else - echo "${DIR} doesn't appear to be git or svn dir." >&2 - echo 0 - exit 1 -fi +# dev should be a tag at the merge-base of master and the +# most recent release. +git describe head --abbrev=7 --match dev diff --git a/tools/get-scala-revision.bat b/tools/get-scala-revision.bat index 880bcc3f5c..ed3ade8a3e 100644 --- a/tools/get-scala-revision.bat +++ b/tools/get-scala-revision.bat @@ -1,17 +1,11 @@ @echo off rem rem Usage: get-scala-revison.bat [dir] -rem Figures out current scala revision of an svn checkout or -rem a git-svn mirror (or a git clone.) +rem Figures out current scala revision of a git clone. rem rem If no dir is given, current working dir is used. -if "%OS%" NEQ "Windows_NT" ( - echo "Sorry, your version of Windows is too old to run Scala." - goto :eof -) @setlocal - set _DIR= if "%*"=="" ( for /f "delims=;" %%i in ('cd') do set "_DIR=%%i" @@ -20,23 +14,10 @@ if "%*"=="" ( ) cd %_DIR% -if exist .svn\NUL ( - rem 2>&1 to catch also error output (e.g. svn warnings) - for /f "skip=4 tokens=2" %%i in ('svn info') do ( - echo %%i - goto :end - ) -) else ( if exist .git\NUL ( - set _GIT_PAGER=type - rem this grabs more than one line because otherwise if you have local - rem commits which aren't in git-svn it won't see any revision. - rem TODO: git log -10 | findstr git-svn-id | ... +if exist .git\NUL ( + git describe head --abbrev=7 --match dev echo 0 -) else ( - echo %_DIR% doesn't appear to be git or svn dir. - echo 0 - exit 1 -)) +) :end @endlocal |