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

Side by Side Diff: mojo/public/tools/bindings/pylib/mojom_tests/support/run_bindings_generator.py

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import os.path
6 from subprocess import check_call
7 import sys
8
9
10 def RunBindingsGenerator(out_dir, root_dir, mojom_file, extra_flags=None):
11 out_dir = os.path.abspath(out_dir)
12 root_dir = os.path.abspath(root_dir)
13 mojom_file = os.path.abspath(mojom_file)
14
15 # The mojom file should be under the root directory somewhere.
16 assert mojom_file.startswith(root_dir)
17 mojom_reldir = os.path.dirname(os.path.relpath(mojom_file, root_dir))
18
19 # TODO(vtl): Abstract out the "main" functions, so that we can just import
20 # the bindings generator (which would be more portable and easier to use in
21 # tests).
22 this_dir = os.path.dirname(os.path.abspath(__file__))
23 # We're in src/mojo/public/tools/bindings/pylib/mojom_tests/support;
24 # mojom_bindings_generator.py is in .../bindings.
25 bindings_generator = os.path.join(this_dir, os.pardir, os.pardir, os.pardir,
26 "mojom_bindings_generator.py")
27
28 args = ["python", bindings_generator,
29 "-o", os.path.join(out_dir, mojom_reldir)]
30 if extra_flags:
31 args.extend(extra_flags)
32 args.append(mojom_file)
33
34 check_call(args)
35
36
37 def main(argv):
38 if len(argv) < 4:
39 print "usage: %s out_dir root_dir mojom_file [extra_flags]" % argv[0]
40 return 1
41
42 RunBindingsGenerator(argv[1], argv[2], argv[3], extra_flags=argv[4:])
43 return 0
44
45
46 if __name__ == '__main__':
47 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/pylib/mojom_tests/support/find_files.py ('k') | mojo/public/tools/bindings/run_code_generators.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698