aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-11-10 09:38:41 -0800
committerDylan Baker <dylan@pnwbakers.com>2020-11-10 12:09:21 -0800
commitce46070b4ee69fe573ff4105d06b970445fea0aa (patch)
tree7e5c85a0c33ed11f1537cf6806988ee64035bd0a /mesonbuild
parenta28b430b681f790122415a371382565d19ea947b (diff)
downloadmeson-ce46070b4ee69fe573ff4105d06b970445fea0aa.zip
meson-ce46070b4ee69fe573ff4105d06b970445fea0aa.tar.gz
meson-ce46070b4ee69fe573ff4105d06b970445fea0aa.tar.bz2
compilers/rust: Add color output
Rust has color output, although it's help doesn't document it. It uses the same values as cargo (and everything else), auto, never, always.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/compilers/rust.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py
index 3b392ec..1be0cd8 100644
--- a/mesonbuild/compilers/rust.py
+++ b/mesonbuild/compilers/rust.py
@@ -17,7 +17,7 @@ import textwrap
import typing as T
from .. import coredata
-from ..mesonlib import EnvironmentException, MachineChoice, Popen_safe
+from ..mesonlib import EnvironmentException, MachineChoice, MesonException, Popen_safe
from .compilers import Compiler, rust_buildtype_args, clike_debug_args
if T.TYPE_CHECKING:
@@ -52,6 +52,7 @@ class RustCompiler(Compiler):
linker=linker)
self.exe_wrapper = exe_wrapper
self.id = 'rustc'
+ self.base_options.append('b_colorout')
if 'link' in self.linker.id:
self.base_options.append('b_vscrt')
@@ -147,3 +148,8 @@ class RustCompiler(Compiler):
def get_crt_compile_args(self, crt_val: str, buildtype: str) -> T.List[str]:
# Rust handles this for us, we don't need to do anything
return []
+
+ def get_colorout_args(self, colortype: str) -> T.List[str]:
+ if colortype in {'always', 'never', 'auto'}:
+ return [f'--color={colortype}']
+ raise MesonException(f'Invalid color type for rust {colortype}')