| 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 the mojom parser and uses that | 6 # This script accepts the output 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 27 matching lines...) Expand all Loading... |
| 38 default=".", | 38 default=".", |
| 39 help="relative path to the root of the source tree.") | 39 help="relative path to the root of the source tree.") |
| 40 parser.add_argument("--no-gen-imports", action="store_true", | 40 parser.add_argument("--no-gen-imports", action="store_true", |
| 41 help="Generate code only for the files that are " | 41 help="Generate code only for the files that are " |
| 42 "specified on the command line. By default, code " | 42 "specified on the command line. By default, code " |
| 43 "is generated for all specified files and their " | 43 "is generated for all specified files and their " |
| 44 "transitive imports.") | 44 "transitive imports.") |
| 45 parser.add_argument("--generate-type-info", dest="generate_type_info", | 45 parser.add_argument("--generate-type-info", dest="generate_type_info", |
| 46 action="store_true", | 46 action="store_true", |
| 47 help="generate mojom type descriptors") | 47 help="generate mojom type descriptors") |
| 48 parser.add_argument("--no-generate-type-info", dest="generate_type_info", | |
| 49 action="store_false", | |
| 50 help="do not generate mojom type descriptors") | |
| 51 parser.set_defaults(generate_type_info=False) | 48 parser.set_defaults(generate_type_info=False) |
| 52 | 49 |
| 53 return parser.parse_known_args() | 50 return parser.parse_known_args() |
| 54 | 51 |
| 55 # We assume this script is located in the Mojo SDK in tools/bindings. | 52 # We assume this script is located in the Mojo SDK in tools/bindings. |
| 56 # If __file__ is a link, we look for the real location of the script. | 53 # If __file__ is a link, we look for the real location of the script. |
| 57 BINDINGS_DIR = os.path.dirname(os.path.realpath(os.path.abspath(__file__))) | 54 BINDINGS_DIR = os.path.dirname(os.path.realpath(os.path.abspath(__file__))) |
| 58 SDK_ROOT = os.path.abspath(os.path.join(BINDINGS_DIR, os.pardir, os.pardir)) | 55 SDK_ROOT = os.path.abspath(os.path.join(BINDINGS_DIR, os.pardir, os.pardir)) |
| 59 PYTHON_SDK_DIR = os.path.abspath(os.path.join(SDK_ROOT, "python")) | 56 PYTHON_SDK_DIR = os.path.abspath(os.path.join(SDK_ROOT, "python")) |
| 60 | 57 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 filtered_args = [arg for arg in remaining_args | 176 filtered_args = [arg for arg in remaining_args |
| 180 if arg.startswith(prefix)] | 177 if arg.startswith(prefix)] |
| 181 if args.generate_type_info: | 178 if args.generate_type_info: |
| 182 filtered_args.append("--generate_type_info") | 179 filtered_args.append("--generate_type_info") |
| 183 | 180 |
| 184 generator.GenerateFiles(filtered_args) | 181 generator.GenerateFiles(filtered_args) |
| 185 | 182 |
| 186 | 183 |
| 187 if __name__ == "__main__": | 184 if __name__ == "__main__": |
| 188 sys.exit(main()) | 185 sys.exit(main()) |
| OLD | NEW |