From 1d8037bbf56b303d69cd3e8faafc05fc5fc5db3e Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Fri, 16 Mar 2012 01:05:31 -0400 Subject: Finished migrating to new versioning scheme Conflicts: build.xml tools/get-scala-revision.bat --- tools/get-scala-commit-date | 16 +++++++++++++++ tools/get-scala-commit-date.bat | 24 ++++++++++++++++++++++ tools/get-scala-commit-drift | 40 ++++++++++++++++++++++++++++++++++++ tools/get-scala-commit-drift.bat | 21 +++++++++++++++++++ tools/get-scala-commit-sha | 39 +++++++++++++++++++++++++++++++++++ tools/get-scala-commit-sha.bat | 21 +++++++++++++++++++ tools/get-scala-revision | 44 ---------------------------------------- tools/get-scala-revision.bat | 27 ------------------------ 8 files changed, 161 insertions(+), 71 deletions(-) create mode 100755 tools/get-scala-commit-date create mode 100644 tools/get-scala-commit-date.bat create mode 100755 tools/get-scala-commit-drift create mode 100644 tools/get-scala-commit-drift.bat create mode 100755 tools/get-scala-commit-sha create mode 100644 tools/get-scala-commit-sha.bat delete mode 100755 tools/get-scala-revision delete mode 100644 tools/get-scala-revision.bat (limited to 'tools') 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-commit-sha b/tools/get-scala-commit-sha new file mode 100755 index 0000000000..0aa70d985c --- /dev/null +++ b/tools/get-scala-commit-sha @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# +# 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: +# g6f1c486d0b +# + +[[ $# -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) + +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 b/tools/get-scala-revision deleted file mode 100755 index 14c84d0ad4..0000000000 --- a/tools/get-scala-revision +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash -# -# 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" - -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) -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" 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 -- cgit v1.2.3