Skip to content

Commit a289465

Browse files
committed
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.
1 parent a179086 commit a289465

File tree

3 files changed

+15
-51
lines changed

3 files changed

+15
-51
lines changed

build.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,21 +232,22 @@ INITIALISATION
232232
<os family="windows"/>
233233
</condition>
234234

235-
<exec osfamily="unix" executable="tools/get-scala-revision" outputproperty="svn.number" failifexecutionfails="false" />
236-
<exec osfamily="windows" executable="tools/get-scala-revision.bat" outputproperty="svn.number" failifexecutionfails="false" />
235+
<exec osfamily="unix" executable="tools/get-scala-revision" outputproperty="git.describe" failifexecutionfails="false" />
236+
<exec osfamily="windows" executable="tools/get-scala-revision.bat" outputproperty="git.describe" failifexecutionfails="false" />
237237
<!-- some default in case something went wrong getting the revision -->
238-
<property name="svn.number" value="0"/>
238+
<property name="git.describe" value="-unknown-"/>
239239

240240
<property name="init.avail" value="yes"/>
241241

242242
<!-- Generating version number -->
243243
<property file="${basedir}/build.number"/>
244244
<property
245245
name="version.number"
246-
value="${version.major}.${version.minor}.${version.patch}.r${svn.number}-b${time.short}"/>
246+
value="${version.major}.${version.minor}.${version.patch}.${git.describe}"/>
247+
247248
<!-- And print-out what we are building -->
248249
<echo level="info" message="Build number is '${version.number}'"/>
249-
<echo level="info" message="Built ${time.human} from revision ${svn.number} with ${java.vm.name} ${java.version}"/>
250+
<echo level="info" message="Built ${time.human} from revision ${git.describe} with ${java.vm.name} ${java.version}"/>
250251

251252
<!-- Local libs (developer use.) -->
252253
<mkdir dir="${lib-extra.dir}"/>

tools/get-scala-revision

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,12 @@
11
#!/bin/sh
22
#
33
# Usage: get-scala-revision [dir]
4-
# Figures out current scala revision of an svn checkout or
5-
# a git-svn mirror (or a git clone.)
4+
# Figures out current scala revision of a git clone.
65
#
76
# If no dir is given, current working dir is used.
87

9-
DIR=""
10-
if [ $# -eq 0 ]; then
11-
DIR=`pwd`
12-
else
13-
DIR=$1
14-
fi
8+
[[ -n "$1" ]] && cd "$1"
159

16-
cd $DIR
17-
18-
if [ -d .svn ]; then
19-
# 2>&1 to catch also error output (e.g. svn warnings)
20-
svn info . 2>&1 | grep ^Revision | sed 's/Revision: //'
21-
elif [ -d .git ]; then
22-
GIT_PAGER=cat
23-
# this grabs more than one line because otherwise if you have local
24-
# commits which aren't in git-svn it won't see any revision.
25-
git log -10 | grep git-svn-id | head -1 | sed 's/[^@]*@\([0-9]*\).*/\1/'
26-
else
27-
echo "${DIR} doesn't appear to be git or svn dir." >&2
28-
echo 0
29-
exit 1
30-
fi
10+
# dev should be a tag at the merge-base of master and the
11+
# most recent release.
12+
git describe head --abbrev=7 --match dev

tools/get-scala-revision.bat

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
@echo off
22
rem
33
rem Usage: get-scala-revison.bat [dir]
4-
rem Figures out current scala revision of an svn checkout or
5-
rem a git-svn mirror (or a git clone.)
4+
rem Figures out current scala revision of a git clone.
65
rem
76
rem If no dir is given, current working dir is used.
87

9-
if "%OS%" NEQ "Windows_NT" (
10-
echo "Sorry, your version of Windows is too old to run Scala."
11-
goto :eof
12-
)
138
@setlocal
14-
159
set _DIR=
1610
if "%*"=="" (
1711
for /f "delims=;" %%i in ('cd') do set "_DIR=%%i"
@@ -20,23 +14,10 @@ if "%*"=="" (
2014
)
2115
cd %_DIR%
2216

23-
if exist .svn\NUL (
24-
rem 2>&1 to catch also error output (e.g. svn warnings)
25-
for /f "skip=4 tokens=2" %%i in ('svn info') do (
26-
echo %%i
27-
goto :end
28-
)
29-
) else ( if exist .git\NUL (
30-
set _GIT_PAGER=type
31-
rem this grabs more than one line because otherwise if you have local
32-
rem commits which aren't in git-svn it won't see any revision.
33-
rem TODO: git log -10 | findstr git-svn-id | ...
17+
if exist .git\NUL (
18+
git describe head --abbrev=7 --match dev
3419
echo 0
35-
) else (
36-
echo %_DIR% doesn't appear to be git or svn dir.
37-
echo 0
38-
exit 1
39-
))
20+
)
4021

4122
:end
4223
@endlocal

0 commit comments

Comments
 (0)