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

Side by Side Diff: tools/mb/mb.py

Issue 2391343002: Add 2 config names for builder 'Blimp Android Tester' (Closed)
Patch Set: Dirk comments. Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/mb/mb_config.pyl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """MB - the Meta-Build wrapper around GYP and GN 6 """MB - the Meta-Build wrapper around GYP and GN
7 7
8 MB is a wrapper script for GYP and GN that can be used to generate build files 8 MB is a wrapper script for GYP and GN that can be used to generate build files
9 for sets of canned configurations and analyze them. 9 for sets of canned configurations and analyze them.
10 """ 10 """
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 return 1 71 return 1
72 72
73 def ParseArgs(self, argv): 73 def ParseArgs(self, argv):
74 def AddCommonOptions(subp): 74 def AddCommonOptions(subp):
75 subp.add_argument('-b', '--builder', 75 subp.add_argument('-b', '--builder',
76 help='builder name to look up config from') 76 help='builder name to look up config from')
77 subp.add_argument('-m', '--master', 77 subp.add_argument('-m', '--master',
78 help='master name to look up config from') 78 help='master name to look up config from')
79 subp.add_argument('-c', '--config', 79 subp.add_argument('-c', '--config',
80 help='configuration to analyze') 80 help='configuration to analyze')
81 subp.add_argument('--phase', type=int, 81 subp.add_argument('--phase',
82 help=('build phase for a given build ' 82 help='optional phase name (used when builders '
83 '(int in [1, 2, ...))')) 83 'do multiple compiles with different '
84 'arguments in a single build)')
84 subp.add_argument('-f', '--config-file', metavar='PATH', 85 subp.add_argument('-f', '--config-file', metavar='PATH',
85 default=self.default_config, 86 default=self.default_config,
86 help='path to config file ' 87 help='path to config file '
87 '(default is //tools/mb/mb_config.pyl)') 88 '(default is //tools/mb/mb_config.pyl)')
88 subp.add_argument('-g', '--goma-dir', 89 subp.add_argument('-g', '--goma-dir',
89 help='path to goma directory') 90 help='path to goma directory')
90 subp.add_argument('--gyp-script', metavar='PATH', 91 subp.add_argument('--gyp-script', metavar='PATH',
91 default=self.PathJoin('build', 'gyp_chromium'), 92 default=self.PathJoin('build', 'gyp_chromium'),
92 help='path to gyp script relative to project root ' 93 help='path to gyp script relative to project root '
93 '(default is %(default)s)') 94 '(default is %(default)s)')
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 def CmdExport(self): 264 def CmdExport(self):
264 self.ReadConfigFile() 265 self.ReadConfigFile()
265 obj = {} 266 obj = {}
266 for master, builders in self.masters.items(): 267 for master, builders in self.masters.items():
267 obj[master] = {} 268 obj[master] = {}
268 for builder in builders: 269 for builder in builders:
269 config = self.masters[master][builder] 270 config = self.masters[master][builder]
270 if not config: 271 if not config:
271 continue 272 continue
272 273
273 if isinstance(config, list): 274 if isinstance(config, dict):
274 args = [self.FlattenConfig(c)['gn_args'] for c in config] 275 args = {k: self.FlattenConfig(v)['gn_args']
276 for k, v in config.items()}
275 elif config.startswith('//'): 277 elif config.startswith('//'):
276 args = config 278 args = config
277 else: 279 else:
278 args = self.FlattenConfig(config)['gn_args'] 280 args = self.FlattenConfig(config)['gn_args']
279 if 'error' in args: 281 if 'error' in args:
280 continue 282 continue
281 283
282 obj[master][builder] = args 284 obj[master][builder] = args
283 285
284 # Dump object and trim trailing whitespace. 286 # Dump object and trim trailing whitespace.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 def CmdValidate(self, print_ok=True): 364 def CmdValidate(self, print_ok=True):
363 errs = [] 365 errs = []
364 366
365 # Read the file to make sure it parses. 367 # Read the file to make sure it parses.
366 self.ReadConfigFile() 368 self.ReadConfigFile()
367 369
368 # Build a list of all of the configs referenced by builders. 370 # Build a list of all of the configs referenced by builders.
369 all_configs = {} 371 all_configs = {}
370 for master in self.masters: 372 for master in self.masters:
371 for config in self.masters[master].values(): 373 for config in self.masters[master].values():
372 if isinstance(config, list): 374 if isinstance(config, dict):
373 for c in config: 375 for c in config.values():
374 all_configs[c] = master 376 all_configs[c] = master
375 else: 377 else:
376 all_configs[config] = master 378 all_configs[config] = master
377 379
378 # Check that every referenced args file or config actually exists. 380 # Check that every referenced args file or config actually exists.
379 for config, loc in all_configs.items(): 381 for config, loc in all_configs.items():
380 if config.startswith('//'): 382 if config.startswith('//'):
381 if not self.Exists(self.ToAbsPath(config)): 383 if not self.Exists(self.ToAbsPath(config)):
382 errs.append('Unknown args file "%s" referenced from "%s".' % 384 errs.append('Unknown args file "%s" referenced from "%s".' %
383 (config, loc)) 385 (config, loc))
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 config_only = config_builders - master_builders 516 config_only = config_builders - master_builders
515 tbd = set() 517 tbd = set()
516 gyp = set() 518 gyp = set()
517 done = set() 519 done = set()
518 notes = {builder: '' for builder in config_builders | master_builders} 520 notes = {builder: '' for builder in config_builders | master_builders}
519 521
520 for builder in both: 522 for builder in both:
521 config = self.masters[master][builder] 523 config = self.masters[master][builder]
522 if config == 'tbd': 524 if config == 'tbd':
523 tbd.add(builder) 525 tbd.add(builder)
524 elif isinstance(config, list): 526 elif isinstance(config, dict):
525 vals = self.FlattenConfig(config[0]) 527 vals = self.FlattenConfig(config.values()[0])
526 if vals['type'] == 'gyp': 528 if vals['type'] == 'gyp':
527 gyp.add(builder) 529 gyp.add(builder)
528 else: 530 else:
529 done.add(builder) 531 done.add(builder)
530 elif config.startswith('//'): 532 elif config.startswith('//'):
531 done.add(builder) 533 done.add(builder)
532 else: 534 else:
533 vals = self.FlattenConfig(config) 535 vals = self.FlattenConfig(config)
534 if vals['type'] == 'gyp': 536 if vals['type'] == 'gyp':
535 gyp.add(builder) 537 gyp.add(builder)
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 688
687 if not self.args.master in self.masters: 689 if not self.args.master in self.masters:
688 raise MBErr('Master name "%s" not found in "%s"' % 690 raise MBErr('Master name "%s" not found in "%s"' %
689 (self.args.master, self.args.config_file)) 691 (self.args.master, self.args.config_file))
690 692
691 if not self.args.builder in self.masters[self.args.master]: 693 if not self.args.builder in self.masters[self.args.master]:
692 raise MBErr('Builder name "%s" not found under masters[%s] in "%s"' % 694 raise MBErr('Builder name "%s" not found under masters[%s] in "%s"' %
693 (self.args.builder, self.args.master, self.args.config_file)) 695 (self.args.builder, self.args.master, self.args.config_file))
694 696
695 config = self.masters[self.args.master][self.args.builder] 697 config = self.masters[self.args.master][self.args.builder]
696 if isinstance(config, list): 698 if isinstance(config, dict):
697 if self.args.phase is None: 699 if self.args.phase is None:
698 raise MBErr('Must specify a build --phase for %s on %s' % 700 raise MBErr('Must specify a build --phase for %s on %s' %
699 (self.args.builder, self.args.master)) 701 (self.args.builder, self.args.master))
700 phase = int(self.args.phase) 702 phase = str(self.args.phase)
701 if phase < 1 or phase > len(config): 703 if phase not in config:
702 raise MBErr('Phase %d out of bounds for %s on %s' % 704 raise MBErr('Phase %s doesn\'t exist for %s on %s' %
703 (phase, self.args.builder, self.args.master)) 705 (phase, self.args.builder, self.args.master))
704 return config[phase-1] 706 return config[phase]
705 707
706 if self.args.phase is not None: 708 if self.args.phase is not None:
707 raise MBErr('Must not specify a build --phase for %s on %s' % 709 raise MBErr('Must not specify a build --phase for %s on %s' %
708 (self.args.builder, self.args.master)) 710 (self.args.builder, self.args.master))
709 return config 711 return config
710 712
711 def FlattenConfig(self, config): 713 def FlattenConfig(self, config):
712 mixins = self.configs[config] 714 mixins = self.configs[config]
713 vals = self.DefaultVals() 715 vals = self.DefaultVals()
714 716
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 # Then check to see if the arg contains any metacharacters other than 1553 # Then check to see if the arg contains any metacharacters other than
1552 # double quotes; if it does, quote everything (including the double 1554 # double quotes; if it does, quote everything (including the double
1553 # quotes) for safety. 1555 # quotes) for safety.
1554 if any(a in UNSAFE_FOR_CMD for a in arg): 1556 if any(a in UNSAFE_FOR_CMD for a in arg):
1555 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) 1557 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg)
1556 return arg 1558 return arg
1557 1559
1558 1560
1559 if __name__ == '__main__': 1561 if __name__ == '__main__':
1560 sys.exit(main(sys.argv[1:])) 1562 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | tools/mb/mb_config.pyl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698