Skip to content

Commit 69c2eb5

Browse files
committed
Establish more baseline tags.
So we can turn out a build string regardless of local conditions.
1 parent 9415696 commit 69c2eb5

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

tools/get-scala-revision

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,31 @@
1111
[[ $# -eq 0 ]] || cd "$1"
1212

1313
ensure_tag () {
14-
# v2.10.0-M1
15-
fallback=58cb15c40d
16-
[[ -n $(git tag -l v2.10.0-M1) ]] || {
17-
git tag -a -m "generated by get-scala-revision" v2.10.0-M1 $fallback
14+
sha=$1
15+
rev=$2
16+
17+
[[ -n $(git tag -l $rev) ]] || {
18+
git tag -a -m "generated by get-scala-revision" $rev $sha
1819
}
1920
}
20-
ensure_tag
21+
22+
# Ensure some baseline tags are present so if this repository's
23+
# tags are screwed up or stale, we should still have a reference
24+
# point for a build string.
25+
ensure_tag 58cb15c40d v2.10.0-M1
26+
ensure_tag 29f3eace1e v2.9.1
27+
ensure_tag b0d78f6b9c v2.8.2
2128

2229
# the closest tag, obtained separately because we have to
2330
# reconstruct the string around the padded distance.
24-
tag=$(git describe --match 'v2*' --abbrev=0)
31+
tag=$(git describe --tags --match 'v2*' --abbrev=0)
2532

26-
# the full string - padding correctness depends on abbrev=10.
27-
described=$(git describe --match 'v2*' --abbrev=10)
33+
# printf %016s is not portable for 0-padding, has to be a digit.
34+
# so we're stuck disassembling it.
35+
described=$(git describe --tags --match 'v2*' --abbrev=10)
2836
suffix="${described##${tag}-}"
2937
counter=$(echo $suffix | cut -d - -f 1)
3038
hash=$(echo $suffix | cut -d - -f 2)
3139

32-
# 016 is rocket-surgically-calibrated to pad the distance from the
33-
# tag to the current commit into a 4-digit number - since maven
34-
# will be treating this as a string, the ide depends on
35-
# 10 being greater than 9 (thus 0010 and 00009.)
36-
printf "%s-%04d-%10s-%s\n" "$tag" "$counter" "$hash" $(date "+%Y-%m-%d")
40+
# v2.10.0-M1-0098-g6f1c486d0b-2012-02-01
41+
printf "%s-%04d-%s-%s\n" "$tag" "$counter" "$hash" $(date "+%Y-%m-%d")

0 commit comments

Comments
 (0)