| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 if not ProcessOptions(options): | 143 if not ProcessOptions(options): |
| 144 parser.print_help() | 144 parser.print_help() |
| 145 return 1 | 145 return 1 |
| 146 | 146 |
| 147 # If there are additional arguments, report error and exit. | 147 # If there are additional arguments, report error and exit. |
| 148 if args: | 148 if args: |
| 149 parser.print_help() | 149 parser.print_help() |
| 150 return 1 | 150 return 1 |
| 151 | 151 |
| 152 # Setup arguments to the snapshot generator binary. | 152 # Setup arguments to the snapshot generator binary. |
| 153 script_args = [] | 153 script_args = ["--error_on_malformed_type"] |
| 154 | 154 |
| 155 # First setup the snapshot output filename. | 155 # First setup the snapshot output filename. |
| 156 script_args.append(''.join([ "--snapshot=", options.output_bin ])) | 156 script_args.append(''.join([ "--snapshot=", options.output_bin ])) |
| 157 | 157 |
| 158 # Next setup all url mapping options specified. | 158 # Next setup all url mapping options specified. |
| 159 for url_arg in options.url_mapping: | 159 for url_arg in options.url_mapping: |
| 160 url_mapping_argument = ''.join(["--url_mapping=", url_arg ]) | 160 url_mapping_argument = ''.join(["--url_mapping=", url_arg ]) |
| 161 script_args.append(url_mapping_argument) | 161 script_args.append(url_mapping_argument) |
| 162 | 162 |
| 163 # Finally append the script name if one is specified. | 163 # Finally append the script name if one is specified. |
| 164 if options.script: | 164 if options.script: |
| 165 script_args.append(options.script) | 165 script_args.append(options.script) |
| 166 | 166 |
| 167 # Construct command line to execute the snapshot generator binary and invoke. | 167 # Construct command line to execute the snapshot generator binary and invoke. |
| 168 if options.target_os == 'android': | 168 if options.target_os == 'android': |
| 169 RunOnAndroid(options) | 169 RunOnAndroid(options) |
| 170 else: | 170 else: |
| 171 command = [ options.executable ] + script_args | 171 command = [ options.executable ] + script_args |
| 172 try: | 172 try: |
| 173 utils.RunCommand(command, outStream=sys.stderr, errStream=sys.stderr, | 173 utils.RunCommand(command, outStream=sys.stderr, errStream=sys.stderr, |
| 174 verbose=options.verbose, printErrorInfo=True) | 174 verbose=options.verbose, printErrorInfo=True) |
| 175 except Exception as e: | 175 except Exception as e: |
| 176 return -1 | 176 return -1 |
| 177 | 177 |
| 178 return 0 | 178 return 0 |
| 179 | 179 |
| 180 | 180 |
| 181 if __name__ == '__main__': | 181 if __name__ == '__main__': |
| 182 sys.exit(Main()) | 182 sys.exit(Main()) |
| OLD | NEW |