OLD | NEW |
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 # This script accepts the output of version 2 of the mojom parser and uses that | 6 # This script accepts the output of version 2 of the mojom parser and uses that |
7 # data to invoke the code generators. | 7 # data to invoke the code generators. |
8 | 8 |
9 import argparse | 9 import argparse |
10 import imp | 10 import imp |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 help="Generate code only for the files that are " | 43 help="Generate code only for the files that are " |
44 "specified on the command line. By default, code " | 44 "specified on the command line. By default, code " |
45 "is generated for all specified files and their " | 45 "is generated for all specified files and their " |
46 "transitive imports.") | 46 "transitive imports.") |
47 parser.add_argument("--generate-type-info", dest="generate_type_info", | 47 parser.add_argument("--generate-type-info", dest="generate_type_info", |
48 action="store_true", | 48 action="store_true", |
49 help="generate mojom type descriptors") | 49 help="generate mojom type descriptors") |
50 parser.add_argument("--no-generate-type-info", dest="generate_type_info", | 50 parser.add_argument("--no-generate-type-info", dest="generate_type_info", |
51 action="store_false", | 51 action="store_false", |
52 help="do not generate mojom type descriptors") | 52 help="do not generate mojom type descriptors") |
53 parser.set_defaults(generate_type_info=True) | 53 parser.set_defaults(generate_type_info=False) |
54 | 54 |
55 return parser.parse_known_args() | 55 return parser.parse_known_args() |
56 | 56 |
57 # We assume this script is located in the Mojo SDK in tools/bindings. | 57 # We assume this script is located in the Mojo SDK in tools/bindings. |
58 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) | 58 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) |
59 SDK_ROOT = os.path.abspath(os.path.join(THIS_DIR, os.pardir, os.pardir)) | 59 SDK_ROOT = os.path.abspath(os.path.join(THIS_DIR, os.pardir, os.pardir)) |
60 PYTHON_SDK_DIR = os.path.abspath(os.path.join(SDK_ROOT, "python")) | 60 PYTHON_SDK_DIR = os.path.abspath(os.path.join(SDK_ROOT, "python")) |
61 | 61 |
62 def _FixPath(): | 62 def _FixPath(): |
63 # We parse command line args before imports in case the caller wishes to | 63 # We parse command line args before imports in case the caller wishes to |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 filtered_args = [arg for arg in remaining_args | 187 filtered_args = [arg for arg in remaining_args |
188 if arg.startswith(prefix)] | 188 if arg.startswith(prefix)] |
189 if args.generate_type_info: | 189 if args.generate_type_info: |
190 filtered_args.append("--generate_type_info") | 190 filtered_args.append("--generate_type_info") |
191 | 191 |
192 generator.GenerateFiles(filtered_args) | 192 generator.GenerateFiles(filtered_args) |
193 | 193 |
194 | 194 |
195 if __name__ == "__main__": | 195 if __name__ == "__main__": |
196 sys.exit(main()) | 196 sys.exit(main()) |
OLD | NEW |