Chromium Code Reviews| Index: tools/mb/mb.py |
| diff --git a/tools/mb/mb.py b/tools/mb/mb.py |
| index 8df9e69be4ecef20088ced8ffdee841602ba1033..2ae4d1ea55de553100a7966ba6a672912b595c20 100755 |
| --- a/tools/mb/mb.py |
| +++ b/tools/mb/mb.py |
| @@ -78,9 +78,9 @@ class MetaBuildWrapper(object): |
| help='master name to look up config from') |
| subp.add_argument('-c', '--config', |
| help='configuration to analyze') |
| - subp.add_argument('--phase', type=int, |
| - help=('build phase for a given build ' |
| - '(int in [1, 2, ...))')) |
| + subp.add_argument('--phase', type=str, |
|
Dirk Pranke
2016/10/07 19:01:58
Just delete the type param; str is the default.
shenghuazhang
2016/10/08 00:21:18
Done.
|
| + help=('build phase dict for a given build (key in ' |
| + '([ "key1": "config1", "key2": "config2", ...])')) |
| subp.add_argument('-f', '--config-file', metavar='PATH', |
| default=self.default_config, |
| help='path to config file ' |
| @@ -272,6 +272,8 @@ class MetaBuildWrapper(object): |
| if isinstance(config, list): |
|
Dirk Pranke
2016/10/07 19:01:58
Since we're changing things to be dicts, the list
shenghuazhang
2016/10/08 00:21:18
Done.
|
| args = [self.FlattenConfig(c)['gn_args'] for c in config] |
| + elif isinstance(config, dict): |
| + args = [self.FlattenConfig(c)['gn_args'] for c in config.values()] |
|
Dirk Pranke
2016/10/07 19:01:59
This isn't quite right, you'll lose the config nam
shenghuazhang
2016/10/08 00:21:18
Done.
|
| elif config.startswith('//'): |
| args = config |
| else: |
| @@ -372,6 +374,9 @@ class MetaBuildWrapper(object): |
| if isinstance(config, list): |
|
Dirk Pranke
2016/10/07 19:01:59
same thing (this'll be dead code).
shenghuazhang
2016/10/08 00:21:18
Done.
|
| for c in config: |
| all_configs[c] = master |
| + elif isinstance(config, dict): |
| + for c in config.values(): |
| + all_configs[c] = master |
| else: |
| all_configs[config] = master |
| @@ -527,6 +532,12 @@ class MetaBuildWrapper(object): |
| gyp.add(builder) |
| else: |
| done.add(builder) |
| + elif isinstance(config, dict): |
| + vals = self.FlattenConfig(config.values()[0]) |
| + if vals['type'] == 'gyp': |
| + gyp.add(builder) |
| + else: |
| + done.add(builder) |
| elif config.startswith('//'): |
| done.add(builder) |
| else: |
| @@ -693,15 +704,15 @@ class MetaBuildWrapper(object): |
| (self.args.builder, self.args.master, self.args.config_file)) |
| config = self.masters[self.args.master][self.args.builder] |
| - if isinstance(config, list): |
| + if isinstance(config, dict): |
| if self.args.phase is None: |
| raise MBErr('Must specify a build --phase for %s on %s' % |
| (self.args.builder, self.args.master)) |
| - phase = int(self.args.phase) |
| - if phase < 1 or phase > len(config): |
| - raise MBErr('Phase %d out of bounds for %s on %s' % |
| + phase = str(self.args.phase) |
| + if phase not in config: |
| + raise MBErr('Phase %s doesn\'t exist for %s on %s' % |
| (phase, self.args.builder, self.args.master)) |
| - return config[phase-1] |
| + return config[phase] |
| if self.args.phase is not None: |
| raise MBErr('Must not specify a build --phase for %s on %s' % |