Skip to content

Commit 6173aec

Browse files
committed
melting-pot: improve tag detection
1 parent 66c777b commit 6173aec

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

melting-pot.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,15 @@ scmURL() {
384384

385385
# Gets the SCM tag for the given GAV.
386386
scmTag() {
387-
echo "$(artifactId "$1")-$(version "$1")"
387+
local tag=$(pomValue "$1" project scm tag)
388+
if [ -z "$tag" -o "$tag" = "HEAD" ]
389+
then
390+
# The <scm><tag> value was not set properly,
391+
# so we guess at the tag naming scheme.
392+
echo "$(artifactId "$1")-$(version "$1")"
393+
else
394+
echo "$tag"
395+
fi
388396
}
389397

390398
# Fetches the source code for the given GAV. Returns the directory.
@@ -395,7 +403,8 @@ retrieveSource() {
395403
test "$2" && scmBranch="$2" || scmBranch="$(scmTag "$1")"
396404
local dir="$(groupId "$1")/$(artifactId "$1")"
397405
debug "git clone \"$scmURL\" --branch \"$scmBranch\" --depth 1 \"$dir\""
398-
git clone "$scmURL" --branch "$scmBranch" --depth 1 "$dir" 2> /dev/null
406+
git clone "$scmURL" --branch "$scmBranch" --depth 1 "$dir" 2> /dev/null ||
407+
die "Could not fetch project source for $1" 3
399408
echo "$dir"
400409
}
401410

@@ -542,8 +551,7 @@ meltDown() {
542551
else
543552
# Treat specified project as a GAV.
544553
info "$1: fetching project source"
545-
local dir="$(retrieveSource "$1" "$branch")"
546-
test -d "$dir" || die "Could not fetch project source" 3
554+
retrieveSource "$1" "$branch"
547555
fi
548556

549557
# Get the project dependencies.

0 commit comments

Comments
 (0)