OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Pulls down the current dart sdk to third_party/dart-sdk/. | 6 """Pulls down the current dart sdk to third_party/dart-sdk/. |
7 | 7 |
8 You can manually force this to run again by removing | 8 You can manually force this to run again by removing |
9 third_party/dart-sdk/STAMP_FILE, which contains the URL of the SDK that | 9 third_party/dart-sdk/STAMP_FILE, which contains the URL of the SDK that |
10 was downloaded. Rolling works by updating LINUX_64_SDK to a new URL. | 10 was downloaded. Rolling works by updating LINUX_64_SDK to a new URL. |
11 """ | 11 """ |
12 | 12 |
13 import os | 13 import os |
14 import shutil | 14 import shutil |
15 import subprocess | 15 import subprocess |
16 import sys | 16 import sys |
17 | 17 |
18 # How to roll the dart sdk: Just change this url! We write this to the stamp | 18 # How to roll the dart sdk: Just change this url! We write this to the stamp |
19 # file after we download, and then check the stamp file for differences. | 19 # file after we download, and then check the stamp file for differences. |
20 SDK_URL_BASE = ('http://gsdview.appspot.com/dart-archive/channels/dev/' | 20 SDK_URL_BASE = ('http://gsdview.appspot.com/dart-archive/channels/dev/raw/' |
21 'raw/45311/sdk/') | 21 '1.12.0-dev.3.1/sdk/') |
22 | 22 |
23 LINUX_64_SDK = 'dartsdk-linux-x64-release.zip' | 23 LINUX_64_SDK = 'dartsdk-linux-x64-release.zip' |
24 MACOS_64_SDK = 'dartsdk-macos-x64-release.zip' | 24 MACOS_64_SDK = 'dartsdk-macos-x64-release.zip' |
25 | 25 |
26 # Path constants. (All of these should be absolute paths.) | 26 # Path constants. (All of these should be absolute paths.) |
27 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) | 27 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) |
28 MOJO_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..')) | 28 MOJO_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..')) |
29 DART_SDK_DIR = os.path.join(MOJO_DIR, 'third_party', 'dart-sdk') | 29 DART_SDK_DIR = os.path.join(MOJO_DIR, 'third_party', 'dart-sdk') |
30 STAMP_FILE = os.path.join(DART_SDK_DIR, 'STAMP_FILE') | 30 STAMP_FILE = os.path.join(DART_SDK_DIR, 'STAMP_FILE') |
31 LIBRARIES_FILE = os.path.join(DART_SDK_DIR,'dart-sdk', | 31 LIBRARIES_FILE = os.path.join(DART_SDK_DIR,'dart-sdk', |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 # Write our stamp file so we don't redownload the sdk. | 89 # Write our stamp file so we don't redownload the sdk. |
90 with open(STAMP_FILE, "w") as stamp_file: | 90 with open(STAMP_FILE, "w") as stamp_file: |
91 stamp_file.write(sdk_url) | 91 stamp_file.write(sdk_url) |
92 | 92 |
93 unzip_command = ['unzip', '-o', '-q', output_file, '-d', DART_SDK_DIR] | 93 unzip_command = ['unzip', '-o', '-q', output_file, '-d', DART_SDK_DIR] |
94 if not RunCommand(unzip_command, fail_hard=False): | 94 if not RunCommand(unzip_command, fail_hard=False): |
95 print "Failed to unzip the dart sdk." | 95 print "Failed to unzip the dart sdk." |
96 return 1 | 96 return 1 |
97 | 97 |
98 # Patch the the dart-sdk/lib/_internal/libraries.dart file | |
99 # so that it understands dart:sky imports. | |
100 patch_command = ['patch', LIBRARIES_FILE, PATCH_FILE] | |
101 if not RunCommand(patch_command, fail_hard=False): | |
102 print "Failed to apply the patch to the Dart libraries file." | |
103 return 1 | |
104 return 0 | 98 return 0 |
105 | 99 |
106 if __name__ == '__main__': | 100 if __name__ == '__main__': |
107 sys.exit(main()) | 101 sys.exit(main()) |
OLD | NEW |