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

Unified Diff: tools/mb/mb.py

Issue 1881823002: Support references to args files in MB. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mb_write_args_file
Patch Set: fix indent Created 4 years, 8 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
« no previous file with comments | « build/args/bots/official.desktop/blimp-engine.gn ('k') | tools/mb/mb_config.pyl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/mb/mb.py
diff --git a/tools/mb/mb.py b/tools/mb/mb.py
index cdf1cc3d46b4b44de7a3e8db6090df0df45b9cd9..ae7de3f28c0747922dc84326a2431c559e3cd42e 100755
--- a/tools/mb/mb.py
+++ b/tools/mb/mb.py
@@ -317,9 +317,13 @@ class MetaBuildWrapper(object):
for config in self.masters[master].values():
all_configs[config] = master
- # Check that every referenced config actually exists.
+ # Check that every referenced args file or config actually exists.
for config, loc in all_configs.items():
- if not config in self.configs:
+ if config.startswith('//'):
+ if not self.Exists(self.ToAbsPath(config)):
+ errs.append('Unknown args file "%s" referenced from "%s".' %
+ (config, loc))
+ elif not config in self.configs:
errs.append('Unknown config "%s" referenced from "%s".' %
(config, loc))
@@ -550,11 +554,19 @@ class MetaBuildWrapper(object):
if not vals:
self.ReadConfigFile()
config = self.ConfigFromArgs()
- if not config in self.configs:
- raise MBErr('Config "%s" not found in %s' %
- (config, self.args.config_file))
-
- vals = self.FlattenConfig(config)
+ if config.startswith('//'):
+ if not self.Exists(self.ToAbsPath(config)):
+ raise MBErr('args file "%s" not found' % config)
+ vals = {
+ 'type': 'gn',
+ 'args_file': config,
+ 'gn_args': '',
+ }
+ else:
+ if not config in self.configs:
+ raise MBErr('Config "%s" not found in %s' %
+ (config, self.args.config_file))
+ vals = self.FlattenConfig(config)
# Do some basic sanity checking on the config so that we
# don't have to do this in every caller.
@@ -873,6 +885,9 @@ class MetaBuildWrapper(object):
# the last instance of each arg is listed.
gn_args = gn_helpers.ToGNString(gn_helpers.FromGNArgs(gn_args))
+ args_file = vals.get('args_file', None)
+ if args_file:
+ gn_args = ('import("%s")\n' % vals['args_file']) + gn_args
return gn_args
def RunGYPGen(self, vals):
« no previous file with comments | « build/args/bots/official.desktop/blimp-engine.gn ('k') | tools/mb/mb_config.pyl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698