Skip to content

Commit 3e44d60

Browse files
committed
melting-pot: handle colored Maven output
When caching successful dependency configurations, we scrape the dependency:list output from build.log. But if the version of Maven is relatively new, then colored output might be enabled, potentially hosing up our rather fragile parsing logic. This commit broadens the regexes used to work with both colored and colorless dependency:list output.
1 parent 00b78cb commit 3e44d60

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

melting-pot.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,8 @@ resolveSource() {
478478
# Gets the list of dependencies for the project in the CWD.
479479
deps() {
480480
cd "$1" || die "No such directory: $1" 16
481-
debug "mvn -DincludeScope=runtime -B dependency:list"
482-
local depList="$(mvn -DincludeScope=runtime -B dependency:list)" ||
481+
debug "mvn -B -DincludeScope=runtime dependency:list"
482+
local depList="$(mvn -B -DincludeScope=runtime dependency:list)" ||
483483
die "Problem fetching dependencies!" 5
484484
echo "$depList" | grep '^\[INFO\] [^ ]' |
485485
sed 's/\[INFO\] //' | sed 's/ .*//' | sort
@@ -712,8 +712,8 @@ successLog="$HOME/.cache/scijava/melting-pot/$1.success.log"
712712
mkdir -p "$(dirname "$successLog")"
713713
714714
# Record dependency configuration of successful build.
715-
deps=$(grep '^\[INFO\] ' "$buildLog" |
716-
sed -e 's/^.\{10\}//' -e 's/ -- .*//' -e 's/ (\([^)]*\))/-\1/' |
715+
deps=$(grep '^\[[^ ]*INFO[^ ]*\] ' "$buildLog" |
716+
sed -e 's/^[^ ]* *//' -e 's/ -- .*//' -e 's/ (\([^)]*\))/-\1/' |
717717
sort | tr '\n' ',')
718718
if [ -z "$(containsLine "$deps" "$successLog")" ]
719719
then
@@ -760,6 +760,9 @@ meltDown() {
760760
# to decide whether to include each component.
761761
generateHelperScripts
762762

763+
# NB: We do *not* include -B here, because we want build.sh to preserve
764+
# colored output if the version of Maven is new enough. We will take care
765+
# elsewhere when parsing it to be flexible about whether colors are present.
763766
local args="-Denforcer.skip"
764767

765768
# Process the dependencies.

0 commit comments

Comments
 (0)