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

Side by Side Diff: mojo/public/tools/bindings/mojom_bindings_generator.py

Issue 302923002: Revert of Generate java bindings for constants. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « mojo/public/tools/bindings/mojom_bindings_generator.gypi ('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 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 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 """The frontend for the Mojo bindings system.""" 6 """The frontend for the Mojo bindings system."""
7 7
8 8
9 import argparse 9 import argparse
10 import imp 10 import imp
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 script_dir = os.path.dirname(os.path.abspath(__file__)) 46 script_dir = os.path.dirname(os.path.abspath(__file__))
47 generators = [] 47 generators = []
48 for generator_name in [s.strip() for s in generators_string.split(",")]: 48 for generator_name in [s.strip() for s in generators_string.split(",")]:
49 # "Built-in" generators: 49 # "Built-in" generators:
50 if generator_name.lower() == "c++": 50 if generator_name.lower() == "c++":
51 generator_name = os.path.join(script_dir, "generators", 51 generator_name = os.path.join(script_dir, "generators",
52 "mojom_cpp_generator.py") 52 "mojom_cpp_generator.py")
53 elif generator_name.lower() == "javascript": 53 elif generator_name.lower() == "javascript":
54 generator_name = os.path.join(script_dir, "generators", 54 generator_name = os.path.join(script_dir, "generators",
55 "mojom_js_generator.py") 55 "mojom_js_generator.py")
56 elif generator_name.lower() == "java":
57 generator_name = os.path.join(script_dir, "generators",
58 "mojom_java_generator.py")
59 # Specified generator python module: 56 # Specified generator python module:
60 elif generator_name.endswith(".py"): 57 elif generator_name.endswith(".py"):
61 pass 58 pass
62 else: 59 else:
63 print "Unknown generator name %s" % generator_name 60 print "Unknown generator name %s" % generator_name
64 sys.exit(1) 61 sys.exit(1)
65 generator_module = imp.load_source(os.path.basename(generator_name)[:-3], 62 generator_module = imp.load_source(os.path.basename(generator_name)[:-3],
66 generator_name) 63 generator_name)
67 generators.append(generator_module) 64 generators.append(generator_module)
68 return generators 65 return generators
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 def main(): 146 def main():
150 parser = argparse.ArgumentParser( 147 parser = argparse.ArgumentParser(
151 description="Generate bindings from mojom files.") 148 description="Generate bindings from mojom files.")
152 parser.add_argument("filename", nargs="+", 149 parser.add_argument("filename", nargs="+",
153 help="mojom input file") 150 help="mojom input file")
154 parser.add_argument("-d", "--depth", dest="depth", default=".", 151 parser.add_argument("-d", "--depth", dest="depth", default=".",
155 help="depth from source root") 152 help="depth from source root")
156 parser.add_argument("-o", "--output_dir", dest="output_dir", default=".", 153 parser.add_argument("-o", "--output_dir", dest="output_dir", default=".",
157 help="output directory for generated files") 154 help="output directory for generated files")
158 parser.add_argument("-g", "--generators", dest="generators_string", 155 parser.add_argument("-g", "--generators", dest="generators_string",
159 metavar="GENERATORS", default="c++,javascript,java", 156 metavar="GENERATORS", default="c++,javascript",
160 help="comma-separated list of generators") 157 help="comma-separated list of generators")
161 parser.add_argument("--debug_print_intermediate", action="store_true", 158 parser.add_argument("--debug_print_intermediate", action="store_true",
162 help="print the intermediate representation") 159 help="print the intermediate representation")
163 parser.add_argument("--use_chromium_bundled_pylibs", action="store_true", 160 parser.add_argument("--use_chromium_bundled_pylibs", action="store_true",
164 help="use Python modules bundled in the Chromium source") 161 help="use Python modules bundled in the Chromium source")
165 (args, remaining_args) = parser.parse_known_args() 162 (args, remaining_args) = parser.parse_known_args()
166 163
167 generator_modules = LoadGenerators(args.generators_string) 164 generator_modules = LoadGenerators(args.generators_string)
168 165
169 if not os.path.exists(args.output_dir): 166 if not os.path.exists(args.output_dir):
170 os.makedirs(args.output_dir) 167 os.makedirs(args.output_dir)
171 168
172 for filename in args.filename: 169 for filename in args.filename:
173 ProcessFile(args, remaining_args, generator_modules, filename) 170 ProcessFile(args, remaining_args, generator_modules, filename)
174 171
175 return 0 172 return 0
176 173
177 174
178 if __name__ == "__main__": 175 if __name__ == "__main__":
179 sys.exit(main()) 176 sys.exit(main())
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/mojom_bindings_generator.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698