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

Unified Diff: tools/mb/mb.py

Issue 1169923008: Add support for GN's --runtime-deps-list-file flag to MB. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/test_targets_list/swarming_targets Created 5 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 side-by-side diff with in-line comments
Download patch
« testing/buildbot/manage.py ('K') | « testing/buildbot/ninja_to_gn.pyl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/mb/mb.py
diff --git a/tools/mb/mb.py b/tools/mb/mb.py
index 0c3d446913a6a6d972ebbd675afb70f81395248b..a0a312dd4f0e37cf3cd41a7b712dfaa4d5b17d09 100755
--- a/tools/mb/mb.py
+++ b/tools/mb/mb.py
@@ -89,6 +89,9 @@ class MetaBuildWrapper(object):
subp = subps.add_parser('gen',
help='generate a new set of build files')
AddCommonOptions(subp)
+ subp.add_argument('--swarming-targets',
+ help='save runtime dependencies for targets in file '
+ '(GN only).')
subp.add_argument('path', nargs=1,
help='path to generate build into')
subp.set_defaults(func=self.CmdGen)
@@ -336,7 +339,37 @@ class MetaBuildWrapper(object):
def RunGNGen(self, path, vals):
cmd = self.GNCmd('gen', path, vals['gn_args'])
+
+ if self.args.swarming_targets:
+ # We need GN to generate the list of runtime dependencies for
+ # the compile targets listed (one per line) in the file so
+ # we can run them via swarming. We use ninja_to_gn.pyl to convert
+ # the compile targets to the matching GN labels.
+ contents = self.ReadFile(self.args.swarming_targets)
+ runtime_deps_targets = contents.splitlines()
+ ninja_targets_to_labels = ast.literal_eval(self.ReadFile(os.path.join(
M-A Ruel 2015/06/10 14:53:40 I trick we used in isolate Go is to pre-process th
Dirk Pranke 2015/06/10 16:07:59 That is a good suggestion, but since .pyl / ast.li
+ self.chromium_src_dir, 'testing', 'buildbot', 'ninja_to_gn.pyl')))
+ gn_labels = []
+ for target in runtime_deps_targets:
+ if not target in ninja_targets_to_label:
+ raise MBErr('test target "%s" not found in %s' %
+ (target, "//testing/buildbot/ninja_to_gn.pyl"))
M-A Ruel 2015/06/10 14:53:40 Use single quotes
Dirk Pranke 2015/06/10 16:07:59 will fix.
+
+ gn_runtime_deps_path = self.ToAbsPath(os.path.join(path,
+ 'runtime_deps'))
+ self.WriteFile(gn_runtime_deps_path, '\n'.join(gn_labels) + '\n')
+ cmd.append('--runtime-deps-list-file=%s' % gn_runtime_deps_path)
M-A Ruel 2015/06/10 14:53:40 use two separate args, it works better on Windows.
Dirk Pranke 2015/06/10 16:07:59 I can't; GN only supports --foo=bar style argument
+
ret, _, _ = self.Run(cmd)
+
+ if self.args.swarming_targets:
+ for target in swarming_targets:
M-A Ruel 2015/06/10 14:53:40 Where is this variable defined? I don't see how th
Dirk Pranke 2015/06/10 16:07:59 Whoops, you're right. This should be looping over
+ output = os.path.join(path, target + '.runtime_deps')
+ deps_path = self.ToAbsPath(os.path.join(path,
+ target + '.runtime_deps'))
+ if not self.Exists(self.ToAbsPath(output)):
+ raise MBErr('did not generate %s' % output)
+
return ret
def GNCmd(self, subcommand, path, gn_args=''):
@@ -387,7 +420,7 @@ class MetaBuildWrapper(object):
outp = json.loads(self.ReadFile(self.args.output_path[0]))
self.Print()
self.Print('analyze output:')
- self.PrintJSON(inp)
+ self.PrintJSON(outp)
Dirk Pranke 2015/06/10 06:43:17 this is an unrelated bug that pylint revealed :).
self.Print()
return ret
« testing/buildbot/manage.py ('K') | « testing/buildbot/ninja_to_gn.pyl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698