Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: tools/create_pub_snapshot.py

Issue 557563002: Store the async-await compiled pub code directly in the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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> <compiler> <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) < 5:
31 raise Exception("""Not enough arguments.
32
33 Usage: create_pub_snapshot.py <dart> <compiler> <package root> <output file>""")
34
35 dart_path = sys.argv[1]
36 compiler = sys.argv[2]
37 package_root = sys.argv[3]
38 output_dir = sys.argv[4]
39
40 # Run the async compiler.
41 status = subprocess.call([
42 dart_path,
43 '--package-root=' + package_root,
44 compiler,
45 output_dir,
46 '--silent'
47 ])
48 if status != 0: return status
49
50 # Generate the snapshot from the output of that.
51 status = subprocess.call([
52 dart_path,
53 '--package-root=' + package_root,
54 '--snapshot=' + os.path.join(output_dir, 'pub.dart.snapshot'),
55 os.path.join(output_dir, 'pub_async/bin/pub.dart')
56 ])
57 if status != 0: return status
58
59
60 if __name__ == '__main__':
61 sys.exit(Main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698