summaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-11-12 20:57:53 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-07-12 01:49:34 +0530
commit5112d0fac2e3b5cdc055e760f4c79d475cf447d4 (patch)
tree20cb1c7b88be6014960a48aa43c6db8bc67d381e /mesonbuild/build.py
parent43f7a750604d1293c4152976c6fc0315270572e6 (diff)
downloadmeson-nirbheek/custom-target-verbose.tar.gz
custom targets: Add a 'console' kwarg for long-running commandsnirbheek/custom-target-verbose
Ninja buffers all commands and prints them only after they are complete. Because of this, long-running commands such as `cargo build` show no output at all and it's impossible to know if the command is merely taking too long or is stuck somewhere. To cater to such use-cases, Ninja has a 'pool' with depth 1 called 'console', and all processes in this pool have the following properties: 1. stdout is connected to the program, so output can be seen in real-time 2. The output of all other commands is buffered and displayed after a command in this pool finishes running 3. Commands in this pool are executed serially (normal commands continue to run in the background) This feature is available since Ninja v1.5 https://ninja-build.org/manual.html#_the_literal_console_literal_pool
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 65438b005..a3cd9933d 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -1638,6 +1638,7 @@ class CustomTarget(Target):
'depfile',
'build_by_default',
'override_options',
+ 'console',
])
def __init__(self, name, subdir, subproject, kwargs, absolute_paths=False):
@@ -1756,6 +1757,11 @@ class CustomTarget(Target):
self.capture = kwargs.get('capture', False)
if self.capture and len(self.outputs) != 1:
raise InvalidArguments('Capturing can only output to a single file.')
+ self.console = kwargs.get('console', False)
+ if not isinstance(self.console, bool):
+ raise InvalidArguments('"console" kwarg only accepts booleans')
+ if self.capture and self.console:
+ raise InvalidArguments("Can't both capture output and output to console")
if 'command' not in kwargs:
raise InvalidArguments('Missing keyword argument "command".')
if 'depfile' in kwargs: