3 # Copyright (C) The Arvados Authors. All rights reserved.
5 # SPDX-License-Identifier: AGPL-3.0 OR Apache-2.0
9 format_last_commit_here() {
10 local format="$1"; shift
11 TZ=UTC git log -n1 --first-parent "--format=format:$format" .
15 # Output the version being built, or if we're building a
16 # dev/prerelease, output a version number based on the git log for
17 # the current working directory.
18 if [[ -n "$ARVADOS_BUILDING_VERSION" ]]; then
19 echo "$ARVADOS_BUILDING_VERSION"
23 local git_ts git_hash prefix
24 if [[ -n "$1" ]] ; then
30 declare $(format_last_commit_here "git_ts=%ct git_hash=%h")
31 ARVADOS_BUILDING_VERSION="$(git describe --abbrev=0).$(date -ud "@$git_ts" +%Y%m%d%H%M%S)"
32 echo "$ARVADOS_BUILDING_VERSION"
35 nohash_version_from_git() {
36 version_from_git $1 | cut -d. -f1-3
39 timestamp_from_git() {
40 format_last_commit_here "%ct"
42 if [[ -n "$1" ]]; then
45 build_version="$(version_from_git)"
47 #UID=$(id -u) # UID is read-only on many systems
48 exec docker run --rm --user $UID -v $PWD:$PWD -w $PWD gradle /bin/sh -c 'gradle clean && gradle test && gradle jar install '"$gradle_upload"