Index: tools/mb/mb.py |
diff --git a/tools/mb/mb.py b/tools/mb/mb.py |
index 3ee71030d0086462afe125bf4064fb3a4a160b00..c21e2f10879f11ee85bc4d03fac9fbd5cfc35a13 100755 |
--- a/tools/mb/mb.py |
+++ b/tools/mb/mb.py |
@@ -78,6 +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('-f', '--config-file', metavar='PATH', |
default=self.default_config, |
help='path to config file ' |
@@ -328,7 +331,11 @@ class MetaBuildWrapper(object): |
all_configs = {} |
for master in self.masters: |
for config in self.masters[master].values(): |
- all_configs[config] = master |
+ if isinstance(config, list): |
+ for c in config: |
+ all_configs[c] = master |
+ else: |
+ all_configs[config] = master |
# Check that every referenced args file or config actually exists. |
for config, loc in all_configs.items(): |
@@ -475,10 +482,15 @@ class MetaBuildWrapper(object): |
config = self.masters[master][builder] |
if config == 'tbd': |
tbd.add(builder) |
+ elif isinstance(config, list): |
+ vals = self.FlattenConfig(config[0]) |
+ if vals['type'] == 'gyp': |
+ gyp.add(builder) |
+ else: |
+ done.add(builder) |
elif config.startswith('//'): |
done.add(builder) |
else: |
- # TODO(dpranke): Check if MB is actually running? |
vals = self.FlattenConfig(config) |
if vals['type'] == 'gyp': |
gyp.add(builder) |
@@ -522,12 +534,6 @@ class MetaBuildWrapper(object): |
self.RunGNGen(vals) |
return vals |
- # TODO: We can only get the config for GN build dirs, not GYP build dirs. |
- # GN stores the args that were used in args.gn in the build dir, |
- # but GYP doesn't store them anywhere. We should consider modifying |
- # gyp_chromium to record the arguments it runs with in a similar |
- # manner. |
- |
mb_type_path = self.PathJoin(self.ToAbsPath(build_dir), 'mb_type') |
if not self.Exists(mb_type_path): |
toolchain_path = self.PathJoin(self.ToAbsPath(build_dir), |
@@ -656,12 +662,24 @@ class MetaBuildWrapper(object): |
raise MBErr('Builder name "%s" not found under masters[%s] in "%s"' % |
(self.args.builder, self.args.master, self.args.config_file)) |
- return self.masters[self.args.master][self.args.builder] |
+ config = self.masters[self.args.master][self.args.builder] |
+ if isinstance(config, list): |
+ 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, self.args.builder, self.args.master)) |
+ return config[phase-1] |
+ |
+ if self.args.phase is not None: |
+ raise MBErr('Must not specify a build --phase for %s on %s' % |
+ (self.args.builder, self.args.master)) |
+ return config |
def FlattenConfig(self, config): |
mixins = self.configs[config] |
- # TODO(dpranke): We really should provide a constructor for the |
- # default set of values. |
vals = { |
'args_file': '', |
'cros_passthrough': False, |
@@ -680,8 +698,6 @@ class MetaBuildWrapper(object): |
if m not in self.mixins: |
raise MBErr('Unknown mixin "%s"' % m) |
- # TODO: check for cycles in mixins. |
- |
visited.append(m) |
mixin_vals = self.mixins[m] |
@@ -976,7 +992,6 @@ class MetaBuildWrapper(object): |
# This needs to mirror the settings in //build/config/ui.gni: |
# use_x11 = is_linux && !use_ozone. |
- # TODO(dpranke): Figure out how to keep this in sync better. |
use_x11 = (self.platform == 'linux2' and |
not android and |
not 'use_ozone=true' in vals['gn_args']) |