| 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 27 matching lines...) Expand all Loading... |
| 38 "form is generated") | 38 "form is generated") |
| 39 result.add_option("--embedder_entry_points_manifest", | 39 result.add_option("--embedder_entry_points_manifest", |
| 40 action="store", type="string", | 40 action="store", type="string", |
| 41 help="input manifest with the vm entry points in a precompiled snapshot") | 41 help="input manifest with the vm entry points in a precompiled snapshot") |
| 42 result.add_option("--script", | 42 result.add_option("--script", |
| 43 action="store", type="string", | 43 action="store", type="string", |
| 44 help="Dart script for which snapshot is to be generated") | 44 help="Dart script for which snapshot is to be generated") |
| 45 result.add_option("--package_root", | 45 result.add_option("--package_root", |
| 46 action="store", type="string", | 46 action="store", type="string", |
| 47 help="path used to resolve package: imports.") | 47 help="path used to resolve package: imports.") |
| 48 result.add_option("--packages", |
| 49 action="store", type="string", |
| 50 help="package config file used to reasolve package: imports.") |
| 48 result.add_option("--url_mapping", | 51 result.add_option("--url_mapping", |
| 49 default=[], | 52 default=[], |
| 50 action="append", | 53 action="append", |
| 51 help=("mapping from url to file name, used when generating snapshots " + | 54 help=("mapping from url to file name, used when generating snapshots " + |
| 52 "E.g.: --url_mapping=fileUri,/path/to/file.dart")) | 55 "E.g.: --url_mapping=fileUri,/path/to/file.dart")) |
| 53 result.add_option("-v", "--verbose", | 56 result.add_option("-v", "--verbose", |
| 54 help='Verbose output.', | 57 help='Verbose output.', |
| 55 default=False, action="store_true") | 58 default=False, action="store_true") |
| 56 result.add_option("--target_os", | 59 result.add_option("--target_os", |
| 57 action="store", type="string", | 60 action="store", type="string", |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 108 |
| 106 # Setup arguments to the snapshot generator binary. | 109 # Setup arguments to the snapshot generator binary. |
| 107 script_args = ["--ignore_unrecognized_flags", | 110 script_args = ["--ignore_unrecognized_flags", |
| 108 "--error_on_bad_type", | 111 "--error_on_bad_type", |
| 109 "--error_on_bad_override"] | 112 "--error_on_bad_override"] |
| 110 | 113 |
| 111 # Pass along the package_root if there is one. | 114 # Pass along the package_root if there is one. |
| 112 if options.package_root: | 115 if options.package_root: |
| 113 script_args.append(''.join([ "--package_root=", options.package_root])) | 116 script_args.append(''.join([ "--package_root=", options.package_root])) |
| 114 | 117 |
| 118 # Pass along the packages if there is one. |
| 119 if options.packages: |
| 120 script_args.append(''.join([ "--packages=", options.packages])) |
| 121 |
| 115 # First setup the vm isolate and regular isolate snapshot output filename. | 122 # First setup the vm isolate and regular isolate snapshot output filename. |
| 116 script_args.append(''.join([ "--vm_isolate_snapshot=", | 123 script_args.append(''.join([ "--vm_isolate_snapshot=", |
| 117 options.vm_output_bin ])) | 124 options.vm_output_bin ])) |
| 118 script_args.append(''.join([ "--isolate_snapshot=", options.output_bin ])) | 125 script_args.append(''.join([ "--isolate_snapshot=", options.output_bin ])) |
| 119 | 126 |
| 120 # Setup the instuctions snapshot output filename | 127 # Setup the instuctions snapshot output filename |
| 121 if options.instructions_bin: | 128 if options.instructions_bin: |
| 122 script_args.append(''.join([ "--instructions_snapshot=", | 129 script_args.append(''.join([ "--instructions_snapshot=", |
| 123 options.instructions_bin ])) | 130 options.instructions_bin ])) |
| 124 | 131 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 145 return -1 | 152 return -1 |
| 146 | 153 |
| 147 # Success, update timestamp file. | 154 # Success, update timestamp file. |
| 148 CreateTimestampFile(options) | 155 CreateTimestampFile(options) |
| 149 | 156 |
| 150 return 0 | 157 return 0 |
| 151 | 158 |
| 152 | 159 |
| 153 if __name__ == '__main__': | 160 if __name__ == '__main__': |
| 154 sys.exit(Main()) | 161 sys.exit(Main()) |
| OLD | NEW |