Fix empty reactor summary on newer Maven versions

On newer Maven versions the reactor summary also contains the project name and version so the regexp needs to be adjusted for this.
Also make sure grep treats binary data as text (-aE switch) so the pipe doesn't choke on this.

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born 2019-08-05 14:40:49 +02:00 committed by GitHub
parent f03f328bf0
commit c136254d5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,14 +25,14 @@ install:
done
}
function print_reactor_summary() {
sed -ne '/\[INFO\] Reactor Summary:/,$ p' "$1" | sed 's/\[INFO\] //'
sed -ne '/\[INFO\] Reactor Summary.*:/,$ p' "$1" | sed 's/\[INFO\] //'
}
function mvnp() {
set -o pipefail # exit build with error when pipes fail
local command=(mvn $@)
exec "${command[@]}" 2>&1 | # execute, redirect stderr to stdout
tee .build.log | # write output to log
stdbuf -oL grep -E '^\[INFO\] Building .+ \[.+\]$' | # filter progress
stdbuf -oL grep -aE '^\[INFO\] Building .+ \[.+\]$' | # filter progress
sed -uE 's/^\[INFO\] Building (.*[^ ])[ ]+\[([0-9]+\/[0-9]+)\]$/\2| \1/' | # prefix project name with progress
sed -e :a -e 's/^.\{1,6\}|/ &/;ta' & # right align progress with padding
local pid=$!