Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: tools/mb/mb.py

Issue 2357483002: Clean up mb_config.pyl now that we're off GYP. (Closed)
Patch Set: (re-)add new mb_config.pyl, update export for comparison Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/mb/mb.py
diff --git a/tools/mb/mb.py b/tools/mb/mb.py
index b9b11963c05aaa834c10596f099aac51ec3b0531..2a010552e3b6cc2d3b076a8f7c6713652bcb40b5 100755
--- a/tools/mb/mb.py
+++ b/tools/mb/mb.py
@@ -120,6 +120,17 @@ class MetaBuildWrapper(object):
'as a JSON object.')
subp.set_defaults(func=self.CmdAnalyze)
+ subp = subps.add_parser('export',
+ help='print out the expanded configuration for'
+ 'each builder as a JSON object')
+ subp.add_argument('-f', '--config-file', metavar='PATH',
+ default=self.default_config,
+ help='path to config file '
+ '(default is //tools/mb/mb_config.pyl)')
+ subp.add_argument('-g', '--goma-dir',
+ help='path to goma directory')
+ subp.set_defaults(func=self.CmdExport)
+
subp = subps.add_parser('gen',
help='generate a new set of build files')
AddCommonOptions(subp)
@@ -249,6 +260,33 @@ class MetaBuildWrapper(object):
else:
return self.RunGYPAnalyze(vals)
+ def CmdExport(self):
+ self.ReadConfigFile()
+ obj = {}
+ for master, builders in self.masters.items():
+ obj[master] = {}
+ for builder in builders:
+ config = self.masters[master][builder]
+ if not config:
+ continue
+
+ if isinstance(config, list):
+ args = [self.FlattenConfig(c)['gn_args'] for c in config]
+ elif config.startswith('//'):
+ args = config
+ else:
+ args = self.FlattenConfig(config)['gn_args']
+ if 'error' in args:
+ continue
+
+ obj[master][builder] = args
+
+ # Dump object and trim trailing whitespace.
+ s = '\n'.join(l.rstrip() for l in
+ json.dumps(obj, sort_keys=True, indent=2).splitlines())
+ self.Print(s)
+ return 0
+
def CmdGen(self):
vals = self.Lookup()
self.ClobberIfNeeded(vals)
@@ -598,7 +636,8 @@ class MetaBuildWrapper(object):
# Do some basic sanity checking on the config so that we
# don't have to do this in every caller.
- assert 'type' in vals, 'No meta-build type specified in the config'
+ if 'type' not in vals:
+ vals['type'] = 'gn'
assert vals['type'] in ('gn', 'gyp'), (
'Unknown meta-build type "%s"' % vals['gn_args'])
@@ -688,7 +727,7 @@ class MetaBuildWrapper(object):
vals = {
'args_file': '',
'cros_passthrough': False,
- 'gn_args': [],
+ 'gn_args': '',
'gyp_defines': '',
'gyp_crosscompile': False,
'type': None,
« no previous file with comments | « tools/mb/PRESUBMIT.py ('k') | tools/mb/mb_config.pyl » ('j') | tools/mb/mb_config.pyl » ('J')

Powered by Google App Engine
This is Rietveld 408576698