Meson: print colorful warnings for Vala warnings and errors

Created on 20 May 2017  路  4Comments  路  Source: mesonbuild/meson

The Vala compiler outputs colorful warnings and errors by default (since version 0.27.1) but Meson shows them only in black and white.

enhancement vala

Most helpful comment

A --color=always option was added to Vala with this commit:
https://git.gnome.org/browse/vala/commit/?id=e1b399b332dbf0875b6de8499f31877db6f9f3a1
It will appear in the 0.38 stable release.

All 4 comments

That's because Ninja runs it with stdout and stderr redirected so the compiler thinks it is not connected to a terminal and switches to plain text mode. Other compilers have a switch to force color output even in this case. If Vala has one, then support for that needs to be added for this to work.

At a glance it has --no-color but nothing to force it so that would have to be added upstream.

A --color=always option was added to Vala with this commit:
https://git.gnome.org/browse/vala/commit/?id=e1b399b332dbf0875b6de8499f31877db6f9f3a1
It will appear in the 0.38 stable release.

The Compiler class has a get_colorout_args(self, colortype) method that returns an array. So the ValaCompiler class would need to override that method and return the --color=always option when colortype is 'always'.

The problem is this should only happen when valac --api-version returns a value of 0.38 or greater. By using --api-version it allows for the current development version of valac to produce color warnings with meson. The problem is environment.py uses valac --version, rather than valac --api-version. valac --version returns something like Vala 0.36.1.38-6532 for valac built from master. The question is whether it is worthwhile adding something to environment.py to also pull valac's API version in to Meson, as well as the release version.

Was this page helpful?
0 / 5 - 0 ratings