From: Simon Ruderich Date: Sat, 17 Mar 2012 23:25:36 +0000 (+0100) Subject: Support colored non-verbose build systems. X-Git-Tag: 0.01~95 X-Git-Url: https://ruderich.org/simon/gitweb/?p=blhc%2Fblhc.git;a=commitdiff_plain;h=ca67c9cf80b5b8e3ca1c0e44d1d10e4d67020d5e Support colored non-verbose build systems. --- diff --git a/bin/blhc b/bin/blhc index 1d1fc27..a884e11 100755 --- a/bin/blhc +++ b/bin/blhc @@ -166,7 +166,7 @@ sub is_non_verbose_build { my ($line, $next_line, $skip_ref) = @_; if (not ($line =~ /^checking if you want to see long compiling messages\.\.\. no/ - or $line =~ /^\s*(?:CC|CCLD)\s+(.+?)$/ + or $line =~ /^\s*\[?(?:CC|CCLD|LD)\]?\s+(.+?)$/ or $line =~ /^\s*(?:C|c)ompiling\s+(.+?)(?:\.\.\.)?$/ or $line =~ /^\s*(?:B|b)uilding (?:program|shared library)\s+(.+?)$/ or $line =~ /^\s*\[[\d ]+%\] Building (?:C|CXX) object (.+?)$/)) { @@ -282,6 +282,13 @@ while (my $line = <>) { # Ignore compiler warnings for now. next if $line =~ /$warning_regex/; + # Remove all ANSI color sequences which are sometimes used in non-verbose + # builds. + $line = Term::ANSIColor::colorstrip($line); + # Also strip '\0xf' (delete previous character), used by Elink's build + # system. + $line =~ s/\x0f//g; + # Check if this line indicates a non verbose build. my $non_verbose = is_non_verbose_build($line); diff --git a/t/logs/verbose-build b/t/logs/verbose-build index c54e199..2ae94d9 100644 --- a/t/logs/verbose-build +++ b/t/logs/verbose-build @@ -16,6 +16,19 @@ checking whether compiling and linking against OpenSSL works... yes ... CCLD libtest.la + [CC] src/test-a.o + [CC] src/test-b.o + [CC] src/test_c.o +... + [LD] src/test.o + +# Colored build output. + [CC] src/test-a.o + [CC] src/test-b.o + [CC] src/test_c.o +... + [LD] src/test.o + CC modules/server/test.c Byte-compiling python modules... diff --git a/t/tests.t b/t/tests.t index f336cad..6ec7c69 100644 --- a/t/tests.t +++ b/t/tests.t @@ -309,6 +309,14 @@ NONVERBOSE BUILD: CC libtest-b.lo NONVERBOSE BUILD: CC libtest_c.lo NONVERBOSE BUILD: CC libtest-d.lo NONVERBOSE BUILD: CCLD libtest.la +NONVERBOSE BUILD: [CC] src/test-a.o +NONVERBOSE BUILD: [CC] src/test-b.o +NONVERBOSE BUILD: [CC] src/test_c.o +NONVERBOSE BUILD: [LD] src/test.o +NONVERBOSE BUILD: [CC] src/test-a.o +NONVERBOSE BUILD: [CC] src/test-b.o +NONVERBOSE BUILD: [CC] src/test_c.o +NONVERBOSE BUILD: [LD] src/test.o NONVERBOSE BUILD: CC modules/server/test.c NONVERBOSE BUILD: Compiling test/test.cc to ../build/test/test.o NONVERBOSE BUILD: Building shared library ../build/test/libtest.so.1.2.3