Boost logo

Boost-Build :

Subject: [Boost-build] [idea] ECHO rule output in colours
From: Mateusz Łoskot (mateusz_at_[hidden])
Date: 2012-01-02 16:50:48


Hi,

I've been dreaming [1] about implementing colourful output from
Boost.Built for a while now.

[1] https://svn.boost.org/trac/boost/ticket/3508

I know close to nothing about internals of Boost.Built.
Simply, I have scanned and read through tools/build/v2/*.jam files and
C source code in tools/build/v2/engine
and came up with the following idea:

Colour is specified by name given as optional argument to ECHO rule:

ECHO "hello world" : green ;

ECHO supports limited number of popular colours: red, green, blue, yellow,
and may be cyan and magenta too.

ECHO could also support extra argument specifying font weight, two
values only: bold or normal

Next, builtin_echo() determines if any of formatting arguments have
been specified
and passes relevant arguments to printing like list_print.
It means, list_print and other printing functions need to be modified.

So, the colouring machinery is implemented in C in the
tools/build/v2/engine only
and it should support Unix consoles and Windows.

Once colouring for ECHO rule is available, I'm thinking about updating .jam
parts to format output where it makes sense.
For example:
- Compiler and linker errors in red (bold)
- Compiler and linker warnings in yellow (bold)
- In test module: **passed** in green and **failed** in red (bold)
- Boost.Build errors in cyan (normal)
- Boost.Build progress indicated with colours, e.g. final command on
target in green
etc.

IMHO, colours if used properly could extremely improve readability of
BBv2 output.

Is this a good idea?
Am I tackling it from the right angle or there is a better approach?
I'd appreciate any comments.

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk