summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJosh Suereth <joshua.suereth@gmail.com>2012-03-16 01:05:31 -0400
committerJosh Suereth <joshua.suereth@gmail.com>2012-03-16 12:08:42 -0400
commit1d8037bbf56b303d69cd3e8faafc05fc5fc5db3e (patch)
tree29f06951c7ee8c161906a50ec0cfcab61ef09ea0 /tools
parent479aee3617e952d8705b95ef2ea3a155914dd03c (diff)
downloadscala-1d8037bbf56b303d69cd3e8faafc05fc5fc5db3e.tar.gz
scala-1d8037bbf56b303d69cd3e8faafc05fc5fc5db3e.tar.bz2
scala-1d8037bbf56b303d69cd3e8faafc05fc5fc5db3e.zip
Finished migrating to new versioning scheme
Conflicts: build.xml tools/get-scala-revision.bat
Diffstat (limited to 'tools')
-rwxr-xr-xtools/get-scala-commit-date16
-rw-r--r--tools/get-scala-commit-date.bat24
-rwxr-xr-xtools/get-scala-commit-drift40
-rw-r--r--tools/get-scala-commit-drift.bat21
-rwxr-xr-xtools/get-scala-commit-sha (renamed from tools/get-scala-revision)13
-rw-r--r--tools/get-scala-commit-sha.bat21
-rw-r--r--tools/get-scala-revision.bat27
7 files changed, 126 insertions, 36 deletions
diff --git a/tools/get-scala-commit-date b/tools/get-scala-commit-date
new file mode 100755
index 0000000000..ef5b0f540d
--- /dev/null
+++ b/tools/get-scala-commit-date
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+#
+# Usage: get-scala-commit-date [dir]
+# Figures out current commit date of a git clone.
+# If no dir is given, current working dir is used.
+#
+# Example build version string:
+# 20120312
+#
+
+[[ $# -eq 0 ]] || cd "$1"
+
+lastcommitdate=$(git log --format="%ci" HEAD | head -n 1 | cut -d ' ' -f 1)
+
+# 20120324
+echo "${lastcommitdate//-/}"
diff --git a/tools/get-scala-commit-date.bat b/tools/get-scala-commit-date.bat
new file mode 100644
index 0000000000..a07155533f
--- /dev/null
+++ b/tools/get-scala-commit-date.bat
@@ -0,0 +1,24 @@
+@echo off
+rem
+rem Usage: get-scala-revison.bat [dir]
+rem Figures out current scala commit date of a git clone.
+rem
+rem If no dir is given, current working dir is used.
+
+@setlocal
+set _DIR=
+if "%*"=="" (
+ for /f "delims=;" %%i in ('cd') do set "_DIR=%%i"
+) else (
+ set "_DIR=%~1"
+)
+cd %_DIR%
+
+rem TODO - Check with a real windows user that this works!
+if exist .git\NUL (
+ for /f "tokens=1delims= " in ('git log --format="%ci" -1') do set commitdate=%%a
+ echo %commitdate%
+)
+
+:end
+@endlocal
diff --git a/tools/get-scala-commit-drift b/tools/get-scala-commit-drift
new file mode 100755
index 0000000000..4959826ec1
--- /dev/null
+++ b/tools/get-scala-commit-drift
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+#
+# Usage: get-scala-commit-drift [dir]
+# Figures out current commit drift of a git clone.
+# If no dir is given, current working dir is used.
+#
+# Example output string:
+# 123
+#
+# Build drift = # of commits since last tag.
+
+[[ $# -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"
diff --git a/tools/get-scala-commit-drift.bat b/tools/get-scala-commit-drift.bat
new file mode 100644
index 0000000000..ac289d3481
--- /dev/null
+++ b/tools/get-scala-commit-drift.bat
@@ -0,0 +1,21 @@
+@echo off
+rem
+rem Usage: get-scala-commit-drift.bat [dir]
+rem Figures out current scala commit drift, of a clone.
+rem
+rem If no dir is given, current working dir is used.
+
+@setlocal
+set _DIR=
+if "%*"=="" (
+ for /f "delims=;" %%i in ('cd') do set "_DIR=%%i"
+) else (
+ set "_DIR=%~1"
+)
+cd %_DIR%
+
+rem TODO - WRITE THIS
+echo "TODO"
+
+:end
+@endlocal
diff --git a/tools/get-scala-revision b/tools/get-scala-commit-sha
index 14c84d0ad4..0aa70d985c 100755
--- a/tools/get-scala-revision
+++ b/tools/get-scala-commit-sha
@@ -1,11 +1,11 @@
#!/usr/bin/env bash
#
-# Usage: get-scala-revision [dir]
-# Figures out current scala revision of a git clone.
+# Usage: get-scala-commit-sha [dir]
+# Figures out current commit sha 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
+# g6f1c486d0b
#
[[ $# -eq 0 ]] || cd "$1"
@@ -34,11 +34,6 @@ tag=$(git describe --tags --match 'v2*' --abbrev=0)
# so we're stuck disassembling it.
described=$(git describe --tags --match 'v2*' --abbrev=10)
suffix="${described##${tag}-}"
-counter=$(echo $suffix | cut -d - -f 1)
hash=$(echo $suffix | cut -d - -f 2)
-# remove any alphabetic characters before the version number
-tag=$(echo $tag | sed "s/\([a-z_A-Z]*\)\(.*\)/\2/")
-
-# 20120324-123-b0d78f7b9c
-printf "%s-%04d-%s\n" $(date "+%Y%m%d") "$counter" "$hash"
+echo "$hash"
diff --git a/tools/get-scala-commit-sha.bat b/tools/get-scala-commit-sha.bat
new file mode 100644
index 0000000000..80d9aa34b1
--- /dev/null
+++ b/tools/get-scala-commit-sha.bat
@@ -0,0 +1,21 @@
+@echo off
+rem
+rem Usage: get-scala-commit-drift.bat [dir]
+rem Figures out current scala commit drift, of a clone.
+rem
+rem If no dir is given, current working dir is used.
+
+@setlocal
+set _DIR=
+if "%*"=="" (
+ for /f "delims=;" %%i in ('cd') do set "_DIR=%%i"
+) else (
+ set "_DIR=%~1"
+)
+cd %_DIR%
+
+rem TODO - truncate chars.
+git log -1 --format="%T"
+
+:end
+@endlocal
diff --git a/tools/get-scala-revision.bat b/tools/get-scala-revision.bat
deleted file mode 100644
index b5b30eb3a8..0000000000
--- a/tools/get-scala-revision.bat
+++ /dev/null
@@ -1,27 +0,0 @@
-@echo off
-rem
-rem Usage: get-scala-revison.bat [dir]
-rem Figures out current scala revision of a git clone.
-rem
-rem If no dir is given, current working dir is used.
-
-@setlocal
-set _DIR=
-if "%*"=="" (
- for /f "delims=;" %%i in ('cd') do set "_DIR=%%i"
-) else (
- set "_DIR=%~1"
-)
-cd %_DIR%
-
-rem TODO - Look up bat scripting example and fix the darn string.
-if exist .git\NUL (
- git describe --abbrev=10 --always --tags
-)
-
-rem Implement something like the following
-rem for /f "tokens=1,2,3 delims=- " %%a in ("%gitdescribe%") do set version=%%a&set commits=%%b&set sha=%%c
-rem echo %date?%-%commits%-%sha%
-
-:end
-@endlocal