diff options
author | Stefan Zeiger <szeiger@novocode.com> | 2017-02-23 15:47:52 +0100 |
---|---|---|
committer | Stefan Zeiger <szeiger@novocode.com> | 2017-02-28 13:11:58 +0100 |
commit | 992a1135836dadb9494bdaa7c0363dffc3b965c8 (patch) | |
tree | 1974f70215225bc5b9c63cc5e119f2fc5caa0637 /tools | |
parent | 920bc4e31c5415d98c1a7f26aebc790250aafe4a (diff) | |
download | scala-992a1135836dadb9494bdaa7c0363dffc3b965c8.tar.gz scala-992a1135836dadb9494bdaa7c0363dffc3b965c8.tar.bz2 scala-992a1135836dadb9494bdaa7c0363dffc3b965c8.zip |
Get commit SHA and date with JGit
In order to get the SHA and date we used to run shell scripts and parse
the output of `git` commands. On Windows we even ran a batch file that
looked for `bash.exe` and then ran the shell script in bash.
Using JGit should be more robust than the old Rube Goldberg
implementation. The values produced are the same, except for the time
zone. Previously the timestamp was formatted with the local timezone,
now we use UTC.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/get-scala-commit-date | 22 | ||||
-rw-r--r-- | tools/get-scala-commit-date.bat | 9 | ||||
-rwxr-xr-x | tools/get-scala-commit-sha | 22 | ||||
-rw-r--r-- | tools/get-scala-commit-sha.bat | 9 |
4 files changed, 0 insertions, 62 deletions
diff --git a/tools/get-scala-commit-date b/tools/get-scala-commit-date deleted file mode 100755 index 6511ed98ca..0000000000 --- a/tools/get-scala-commit-date +++ /dev/null @@ -1,22 +0,0 @@ -#!/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" - -if git rev-parse --is-inside-work-tree > /dev/null 2>&1; then - lastcommitdate=$(git log --format="%ci" HEAD | head -n 1 | cut -d ' ' -f 1) - lastcommithours=$(git log --format="%ci" HEAD | head -n 1 | cut -d ' ' -f 2) -else - lastcommitdate=$(date +%Y-%m-%d) - lastcommithours=$(date +%H:%M:%S) -fi - -# 20120324 -echo "${lastcommitdate//-/}-${lastcommithours//:/}" diff --git a/tools/get-scala-commit-date.bat b/tools/get-scala-commit-date.bat deleted file mode 100644 index 735a80b927..0000000000 --- a/tools/get-scala-commit-date.bat +++ /dev/null @@ -1,9 +0,0 @@ -@echo off -for %%X in (bash.exe) do (set FOUND=%%~$PATH:X) -if defined FOUND ( - bash "%~dp0\get-scala-commit-date" 2>NUL -) else ( - rem echo this script does not work with cmd.exe. please, install bash - echo unknown - exit 1 -) diff --git a/tools/get-scala-commit-sha b/tools/get-scala-commit-sha deleted file mode 100755 index 18289c7ca8..0000000000 --- a/tools/get-scala-commit-sha +++ /dev/null @@ -1,22 +0,0 @@ -#!/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: -# 6f1c486d0ba -# - -[[ $# -eq 0 ]] || cd "$1" - -if git rev-parse --is-inside-work-tree > /dev/null 2>&1; then - # printf %016s is not portable for 0-padding, has to be a digit. - # so we're stuck disassembling it. - hash=$(git log -1 --format="%H" HEAD) - hash=${hash#g} - hash=${hash:0:10} -else - hash="unknown" -fi -echo "$hash" diff --git a/tools/get-scala-commit-sha.bat b/tools/get-scala-commit-sha.bat deleted file mode 100644 index 6559a19120..0000000000 --- a/tools/get-scala-commit-sha.bat +++ /dev/null @@ -1,9 +0,0 @@ -@echo off -for %%X in (bash.exe) do (set FOUND=%%~$PATH:X) -if defined FOUND ( - bash "%~dp0\get-scala-commit-sha" 2>NUL -) else ( - rem echo this script does not work with cmd.exe. please, install bash - echo unknown - exit 1 -) |