OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
6 | 6 |
7 """Script to create snapshot bin file.""" | 7 """Script to create snapshot bin file.""" |
8 | 8 |
9 import getopt | 9 import getopt |
10 import optparse | 10 import optparse |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 if not ProcessOptions(options): | 66 if not ProcessOptions(options): |
67 parser.print_help() | 67 parser.print_help() |
68 return 1 | 68 return 1 |
69 | 69 |
70 # If there are additional arguments, report error and exit. | 70 # If there are additional arguments, report error and exit. |
71 if args: | 71 if args: |
72 parser.print_help() | 72 parser.print_help() |
73 return 1 | 73 return 1 |
74 | 74 |
75 # Setup arguments to the snapshot generator binary. | 75 # Setup arguments to the snapshot generator binary. |
76 script_args = ["--error_on_malformed_type"] | 76 script_args = ["--error_on_malformed_type", "--error_on_bad_override"] |
77 | 77 |
78 # First setup the snapshot output filename. | 78 # First setup the snapshot output filename. |
79 script_args.append(''.join([ "--snapshot=", options.output_bin ])) | 79 script_args.append(''.join([ "--snapshot=", options.output_bin ])) |
80 | 80 |
81 # Next setup all url mapping options specified. | 81 # Next setup all url mapping options specified. |
82 for url_arg in options.url_mapping: | 82 for url_arg in options.url_mapping: |
83 url_mapping_argument = ''.join(["--url_mapping=", url_arg ]) | 83 url_mapping_argument = ''.join(["--url_mapping=", url_arg ]) |
84 script_args.append(url_mapping_argument) | 84 script_args.append(url_mapping_argument) |
85 | 85 |
86 # Finally append the script name if one is specified. | 86 # Finally append the script name if one is specified. |
87 if options.script: | 87 if options.script: |
88 script_args.append(options.script) | 88 script_args.append(options.script) |
89 | 89 |
90 # Construct command line to execute the snapshot generator binary and invoke. | 90 # Construct command line to execute the snapshot generator binary and invoke. |
91 command = [ options.executable ] + script_args | 91 command = [ options.executable ] + script_args |
92 try: | 92 try: |
93 utils.RunCommand(command, outStream=sys.stderr, errStream=sys.stderr, | 93 utils.RunCommand(command, outStream=sys.stderr, errStream=sys.stderr, |
94 verbose=options.verbose, printErrorInfo=True) | 94 verbose=options.verbose, printErrorInfo=True) |
95 except Exception as e: | 95 except Exception as e: |
96 return -1 | 96 return -1 |
97 | 97 |
98 return 0 | 98 return 0 |
99 | 99 |
100 | 100 |
101 if __name__ == '__main__': | 101 if __name__ == '__main__': |
102 sys.exit(Main()) | 102 sys.exit(Main()) |
OLD | NEW |