Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 | |
| 3 # Copyright (c) 2014 The Dart Authors. All rights reserved. | |
| 4 # Use of this source code is governed by a BSD-style license that can be | |
| 5 # found in the LICENSE file. | |
| 6 | |
| 7 """ | |
| 8 This script runs the async/await compiler on pub and then compiles the output | |
| 9 of that to a snapshot. | |
| 10 | |
| 11 Usage: create_pub_snapshot.py <dart> <package root> <output dir> | |
| 12 | |
| 13 When #104 is fixed, this script is no longer needed. Instead, replace the | |
| 14 generate_pub_snapshot action in utils/pub.gyp with: | |
| 15 | |
| 16 'action': [ | |
| 17 '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)', | |
| 18 '--package-root=<(PRODUCT_DIR)/pub_packages/', | |
| 19 '--snapshot=<(SHARED_INTERMEDIATE_DIR)/pub.dart.snapshot', | |
| 20 '../../sdk/lib/_internal/pub/bin/pub.dart', | |
| 21 ] | |
| 22 """ | |
| 23 | |
| 24 import os | |
| 25 import subprocess | |
| 26 import sys | |
| 27 | |
| 28 | |
| 29 def Main(): | |
| 30 if len(sys.argv) < 4: | |
| 31 raise Exception("""Not enough arguments. | |
| 32 | |
| 33 Usage: create_pub_snapshot.py <dart> <package root> <output file>""") | |
| 34 | |
| 35 dart_path = sys.argv[1] | |
| 36 package_root = sys.argv[2] | |
| 37 output_dir = sys.argv[3] | |
| 38 | |
| 39 # Run the async compiler. | |
| 40 status = subprocess.call([ | |
| 41 dart_path, | |
| 42 '--package-root=' + package_root, | |
| 43 '../../sdk/lib/_internal/pub/bin/async_compile.dart', | |
|
ricow1
2014/08/25 06:22:03
please add a comment about what this is relative t
Bob Nystrom
2014/08/25 17:40:00
Done.
| |
| 44 output_dir, | |
| 45 '--silent' | |
| 46 ]) | |
| 47 if status != 0: return status | |
| 48 | |
| 49 # Generate the snapshot from the output of that. | |
| 50 subprocess.call([ | |
|
ricow1
2014/08/25 06:22:03
set status = this call, otherwise the exitcode is
Bob Nystrom
2014/08/25 17:40:00
Oops, good catch! Fixed.
| |
| 51 dart_path, | |
| 52 '--package-root=' + package_root, | |
| 53 '--snapshot=' + os.path.join(output_dir, 'pub.dart.snapshot'), | |
| 54 os.path.join(output_dir, 'pub_async/bin/pub.dart') | |
| 55 ]) | |
| 56 if status != 0: return status | |
| 57 | |
| 58 | |
| 59 if __name__ == '__main__': | |
| 60 sys.exit(Main()) | |
| OLD | NEW |