@@ -441,13 +441,23 @@ resolveSource() {
441
441
# Check whether the needed branch/tag exists.
442
442
local scmBranch
443
443
test " $2 " && scmBranch=" $2 " || scmBranch=" $( scmTag " $1 " ) "
444
+ test " $scmBranch " || die " $1 : cannot glean SCM tag" 14
444
445
debug " git ls-remote \" file://$cachedRepoDir \" | grep -q \" \brefs/tags/$scmBranch $\" "
445
446
git ls-remote " file://$cachedRepoDir " | grep -q " \brefs/tags/$scmBranch $" || {
446
447
# Couldn't find the scmBranch as a tag in the cached repo. Either the
447
448
# tag is new, or it's not a tag ref at all (e.g. it's a branch).
448
449
# So let's update from the original remote repository.
449
- info " $1 : local tag not found for ref '$scmBranch '; updating cached repository: $cachedRepoDir "
450
- (cd " $cachedRepoDir " && debug " git fetch --tags" && git fetch --tags)
450
+ info " $1 : local tag not found for ref '$scmBranch '"
451
+ info " $1 : updating cached repository: $cachedRepoDir "
452
+ cd " $cachedRepoDir "
453
+ debug " git fetch --tags"
454
+ if [ " $debug " ]
455
+ then
456
+ git fetch --tags
457
+ else
458
+ git fetch --tags > /dev/null
459
+ fi
460
+ cd - > /dev/null
451
461
}
452
462
453
463
# Shallow clone the source at the given version into melting-pot structure.
@@ -467,7 +477,7 @@ resolveSource() {
467
477
468
478
# Gets the list of dependencies for the project in the CWD.
469
479
deps () {
470
- cd " $1 "
480
+ cd " $1 " || die " No such directory: $1 " 16
471
481
debug " mvn -DincludeScope=runtime -B dependency:list"
472
482
local depList=" $( mvn -DincludeScope=runtime -B dependency:list) " ||
473
483
die " Problem fetching dependencies!" 5
@@ -643,17 +653,18 @@ meltDown() {
643
653
test -f " $1 /pom.xml" || die " Not a Maven project: $1 " 12
644
654
info " Local Maven project: $1 "
645
655
mkdir -p " LOCAL"
646
- local dir =" LOCAL/PROJECT"
647
- ln -s " $1 " " $dir "
656
+ local projectDir =" LOCAL/PROJECT"
657
+ ln -s " $1 " " $projectDir "
648
658
else
649
659
# Treat specified project as a GAV.
650
660
info " Fetching project source"
651
- resolveSource " $1 " " $branch "
661
+ local projectDir=$( resolveSource " $1 " " $branch " )
662
+ test $? -eq 0 || exit $?
652
663
fi
653
664
654
665
# Get the project dependencies.
655
666
info " Determining project dependencies"
656
- local deps=" $( deps " $dir " ) "
667
+ local deps=" $( deps " $projectDir " ) "
657
668
test " $deps " || die " Cannot glean project dependencies" 7
658
669
659
670
local args=" -Denforcer.skip"
@@ -676,7 +687,7 @@ meltDown() {
676
687
if [ " $( isIncluded " $gav " ) " ]
677
688
then
678
689
info " $g :$a : resolving source for version $v "
679
- dir= " $( resolveSource " $gav " ) "
690
+ resolveSource " $gav " > /dev/null
680
691
fi
681
692
done
682
693
0 commit comments