mb: Implement 'quiet' flag in mb lookup

This is a partial port of https://chromium-review.googlesource.com/1576022
Needed because recipes assume the flag exists.

Example error (unnoticed until now because it's silently ignored):
https://logs.chromium.org/logs/webrtc/buildbucket/cr-buildbucket.appspot.com/8911948550157608800/+/steps/lookup_GN_args/0/stdout

Bug: chromium:955062
Change-Id: Id3707903dd5747c13bba05df76f799fb523a6faa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/139248
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28123}
This commit is contained in:
Oleh Prypin
2019-05-31 13:25:39 +02:00
committed by Commit Bot
parent cecf87ff29
commit d7e2fb3309
2 changed files with 15 additions and 4 deletions

View File

@ -157,6 +157,9 @@ class MetaBuildWrapper(object):
help='look up the command for a given config or '
'builder')
AddCommonOptions(subp)
subp.add_argument('--quiet', default=False, action='store_true',
help='Print out just the arguments, '
'do not emulate the output of the gen subcommand.')
subp.set_defaults(func=self.CmdLookup)
subp = subps.add_parser(
@ -286,12 +289,15 @@ class MetaBuildWrapper(object):
def CmdLookup(self):
vals = self.Lookup()
cmd = self.GNCmd('gen', '_path_')
gn_args = self.GNArgs(vals)
self.Print('\nWriting """\\\n%s""" to _path_/args.gn.\n' % gn_args)
env = None
if self.args.quiet:
self.Print(gn_args, end='')
else:
cmd = self.GNCmd('gen', '_path_')
self.Print('\nWriting """\\\n%s""" to _path_/args.gn.\n' % gn_args)
env = None
self.PrintCmd(cmd, env)
self.PrintCmd(cmd, env)
return 0
def CmdRun(self):