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

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

Issue 2027823002: Update mb.py to support gn directories with no args.gn (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | 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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 # TODO: We can only get the config for GN build dirs, not GYP build dirs. 521 # TODO: We can only get the config for GN build dirs, not GYP build dirs.
522 # GN stores the args that were used in args.gn in the build dir, 522 # GN stores the args that were used in args.gn in the build dir,
523 # but GYP doesn't store them anywhere. We should consider modifying 523 # but GYP doesn't store them anywhere. We should consider modifying
524 # gyp_chromium to record the arguments it runs with in a similar 524 # gyp_chromium to record the arguments it runs with in a similar
525 # manner. 525 # manner.
526 526
527 mb_type_path = self.PathJoin(self.ToAbsPath(build_dir), 'mb_type') 527 mb_type_path = self.PathJoin(self.ToAbsPath(build_dir), 'mb_type')
528 if not self.Exists(mb_type_path): 528 if not self.Exists(mb_type_path):
529 gn_args_path = self.PathJoin(self.ToAbsPath(build_dir), 'args.gn') 529 gn_args_path = self.PathJoin(self.ToAbsPath(build_dir), 'args.gn')
530 if not self.Exists(gn_args_path): 530 if not self.Exists(gn_args_path):
531 self.Print('Must either specify a path to an existing GN build dir ' 531 self.Print('Couldn\'t find %s. Must either specify a path to an '
532 'or pass in a -m/-b pair or a -c flag to specify the ' 532 'existing GN build dir or pass in a -m/-b pair or a -c flag '
533 'configuration') 533 'to specify the configuration. If %s is a GN build dir then '
534 'you can use gn args %s to generate args.gn' %
535 (gn_args_path, build_dir, build_dir))
Dirk Pranke 2016/05/31 20:39:03 Ah, good catch. However, the MB code is actually
brucedawson 2016/05/31 20:44:03 Making "it just work" would be better. Is checking
Dirk Pranke 2016/05/31 20:48:23 It's a little bit more complicated. If we think th
534 return {} 536 return {}
535 else: 537 else:
536 mb_type = 'gn' 538 mb_type = 'gn'
537 else: 539 else:
538 mb_type = self.ReadFile(mb_type_path).strip() 540 mb_type = self.ReadFile(mb_type_path).strip()
539 541
540 if mb_type == 'gn': 542 if mb_type == 'gn':
541 vals = self.GNValsFromDir(build_dir) 543 vals = self.GNValsFromDir(build_dir)
542 else: 544 else:
543 vals = {} 545 vals = {}
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 # Then check to see if the arg contains any metacharacters other than 1468 # Then check to see if the arg contains any metacharacters other than
1467 # double quotes; if it does, quote everything (including the double 1469 # double quotes; if it does, quote everything (including the double
1468 # quotes) for safety. 1470 # quotes) for safety.
1469 if any(a in UNSAFE_FOR_CMD for a in arg): 1471 if any(a in UNSAFE_FOR_CMD for a in arg):
1470 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) 1472 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg)
1471 return arg 1473 return arg
1472 1474
1473 1475
1474 if __name__ == '__main__': 1476 if __name__ == '__main__':
1475 sys.exit(main(sys.argv[1:])) 1477 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698