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

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

Issue 1342293002: Move `gn check` into the `generate_build_files` step. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: back out installer changes, do not check //chrome/installer Created 5 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 unified diff | Download patch
« no previous file with comments | « testing/buildbot/tryserver.v8.json ('k') | no next file » | 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 347
348 if needs_clobber: 348 if needs_clobber:
349 self.RemoveDirectory(build_dir) 349 self.RemoveDirectory(build_dir)
350 350
351 self.MaybeMakeDirectory(build_dir) 351 self.MaybeMakeDirectory(build_dir)
352 self.WriteFile(mb_type_path, new_mb_type) 352 self.WriteFile(mb_type_path, new_mb_type)
353 353
354 def RunGNGen(self, vals): 354 def RunGNGen(self, vals):
355 path = self.args.path[0] 355 path = self.args.path[0]
356 356
357 cmd = self.GNCmd('gen', path, vals['gn_args']) 357 cmd = self.GNCmd('gen', path, vals['gn_args'], extra_args=['--check'])
358 358
359 swarming_targets = [] 359 swarming_targets = []
360 if self.args.swarming_targets_file: 360 if self.args.swarming_targets_file:
361 # We need GN to generate the list of runtime dependencies for 361 # We need GN to generate the list of runtime dependencies for
362 # the compile targets listed (one per line) in the file so 362 # the compile targets listed (one per line) in the file so
363 # we can run them via swarming. We use ninja_to_gn.pyl to convert 363 # we can run them via swarming. We use ninja_to_gn.pyl to convert
364 # the compile targets to the matching GN labels. 364 # the compile targets to the matching GN labels.
365 contents = self.ReadFile(self.args.swarming_targets_file) 365 contents = self.ReadFile(self.args.swarming_targets_file)
366 swarming_targets = contents.splitlines() 366 swarming_targets = contents.splitlines()
367 gn_isolate_map = ast.literal_eval(self.ReadFile(os.path.join( 367 gn_isolate_map = ast.literal_eval(self.ReadFile(os.path.join(
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 self.ToSrcRelPath('%s%s%s.isolate' % (path, os.sep, target)), 431 self.ToSrcRelPath('%s%s%s.isolate' % (path, os.sep, target)),
432 ], 432 ],
433 'dir': self.chromium_src_dir, 433 'dir': self.chromium_src_dir,
434 'version': 1, 434 'version': 1,
435 }, 435 },
436 isolate_path + 'd.gen.json', 436 isolate_path + 'd.gen.json',
437 ) 437 )
438 438
439 return ret 439 return ret
440 440
441 def GNCmd(self, subcommand, path, gn_args=''): 441 def GNCmd(self, subcommand, path, gn_args='', extra_args=None):
442 if self.platform == 'linux2': 442 if self.platform == 'linux2':
443 gn_path = os.path.join(self.chromium_src_dir, 'buildtools', 'linux64', 443 gn_path = os.path.join(self.chromium_src_dir, 'buildtools', 'linux64',
444 'gn') 444 'gn')
445 elif self.platform == 'darwin': 445 elif self.platform == 'darwin':
446 gn_path = os.path.join(self.chromium_src_dir, 'buildtools', 'mac', 446 gn_path = os.path.join(self.chromium_src_dir, 'buildtools', 'mac',
447 'gn') 447 'gn')
448 else: 448 else:
449 gn_path = os.path.join(self.chromium_src_dir, 'buildtools', 'win', 449 gn_path = os.path.join(self.chromium_src_dir, 'buildtools', 'win',
450 'gn.exe') 450 'gn.exe')
451 451
452 cmd = [gn_path, subcommand, path] 452 cmd = [gn_path, subcommand, path]
453 gn_args = gn_args.replace("$(goma_dir)", self.args.goma_dir) 453 gn_args = gn_args.replace("$(goma_dir)", self.args.goma_dir)
454 if gn_args: 454 if gn_args:
455 cmd.append('--args=%s' % gn_args) 455 cmd.append('--args=%s' % gn_args)
456 if extra_args:
457 cmd.extend(extra_args)
456 return cmd 458 return cmd
457 459
458 def RunGYPGen(self, vals): 460 def RunGYPGen(self, vals):
459 path = self.args.path[0] 461 path = self.args.path[0]
460 462
461 output_dir, gyp_config = self.ParseGYPConfigPath(path) 463 output_dir, gyp_config = self.ParseGYPConfigPath(path)
462 if gyp_config != vals['gyp_config']: 464 if gyp_config != vals['gyp_config']:
463 raise MBErr('The last component of the path (%s) must match the ' 465 raise MBErr('The last component of the path (%s) must match the '
464 'GYP configuration specified in the config (%s), and ' 466 'GYP configuration specified in the config (%s), and '
465 'it does not.' % (gyp_config, vals['gyp_config'])) 467 'it does not.' % (gyp_config, vals['gyp_config']))
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 834
833 if __name__ == '__main__': 835 if __name__ == '__main__':
834 try: 836 try:
835 sys.exit(main(sys.argv[1:])) 837 sys.exit(main(sys.argv[1:]))
836 except MBErr as e: 838 except MBErr as e:
837 print(e) 839 print(e)
838 sys.exit(1) 840 sys.exit(1)
839 except KeyboardInterrupt: 841 except KeyboardInterrupt:
840 print("interrupted, exiting", stream=sys.stderr) 842 print("interrupted, exiting", stream=sys.stderr)
841 sys.exit(130) 843 sys.exit(130)
OLDNEW
« no previous file with comments | « testing/buildbot/tryserver.v8.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698