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 # A script which will be invoked from gyp to create an SDK. | 7 # A script which will be invoked from gyp to create an SDK. |
8 # | 8 # |
9 # Usage: create_sdk.py sdk_directory | 9 # Usage: create_sdk.py sdk_directory |
10 # | 10 # |
11 # The SDK will be used either from the command-line or from the editor. | 11 # The SDK will be used either from the command-line or from the editor. |
12 # Top structure is | 12 # Top structure is |
13 # | 13 # |
14 # ..dart-sdk/ | 14 # ..dart-sdk/ |
15 # ....bin/ | 15 # ....bin/ |
16 # ......dart or dart.exe (executable) | 16 # ......dart or dart.exe (executable) |
17 # ......dart.lib (import library for VM native extensions on Windows) | 17 # ......dart.lib (import library for VM native extensions on Windows) |
18 # ......dartfmt | 18 # ......dartfmt |
19 # ......dart2js | 19 # ......dart2js |
20 # ......dartanalyzer | 20 # ......dartanalyzer |
21 # ......pub | 21 # ......pub |
22 # ......snapshots/ | 22 # ......snapshots/ |
23 # ........dart2js.dart.snapshot | 23 # ........dart2js.dart.snapshot |
| 24 # ........dartanalyzer.dart.snapshot |
24 # ........dartfmt.dart.snapshot | 25 # ........dartfmt.dart.snapshot |
25 # ........pub.dart.snapshot | 26 # ........pub.dart.snapshot |
26 # ........utils_wrapper.dart.snapshot | 27 # ........utils_wrapper.dart.snapshot |
27 # ....include/ | 28 # ....include/ |
28 # ......dart_api.h | 29 # ......dart_api.h |
29 # ......dart_debugger_api.h | 30 # ......dart_debugger_api.h |
30 # ......dart_mirrors_api.h | 31 # ......dart_mirrors_api.h |
31 # ......dart_native_api.h | 32 # ......dart_native_api.h |
32 # ....lib/ | 33 # ....lib/ |
33 # ......_internal/ | 34 # ......_internal/ |
34 # ......async/ | 35 # ......async/ |
35 # ......collection/ | 36 # ......collection/ |
36 # ......convert/ | 37 # ......convert/ |
37 # ......core/ | 38 # ......core/ |
38 # ......html/ | 39 # ......html/ |
39 # ......internal/ | 40 # ......internal/ |
40 # ......io/ | 41 # ......io/ |
41 # ......isolate/ | 42 # ......isolate/ |
42 # ......js/ | 43 # ......js/ |
43 # ......math/ | 44 # ......math/ |
44 # ......mirrors/ | 45 # ......mirrors/ |
45 # ......typed_data/ | 46 # ......typed_data/ |
46 # ....util/ | 47 # ....util/ |
47 # ......dartanalyzer/ | |
48 # ........dartanalyzer.jar | |
49 # ........(third-party libraries for dart_analyzer) | |
50 # ......(more will come here) | 48 # ......(more will come here) |
51 | 49 |
52 | 50 |
53 import glob | 51 import glob |
54 import optparse | 52 import optparse |
55 import os | 53 import os |
56 import re | 54 import re |
57 import sys | 55 import sys |
58 import subprocess | 56 import subprocess |
59 import tempfile | 57 import tempfile |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 Copy(src, dest) | 105 Copy(src, dest) |
108 | 106 |
109 | 107 |
110 def CopyDartScripts(home, sdk_root): | 108 def CopyDartScripts(home, sdk_root): |
111 for executable in ['dart2js', 'dartanalyzer', 'dartfmt', 'docgen', 'pub']: | 109 for executable in ['dart2js', 'dartanalyzer', 'dartfmt', 'docgen', 'pub']: |
112 CopyShellScript(os.path.join(home, 'sdk', 'bin', executable), | 110 CopyShellScript(os.path.join(home, 'sdk', 'bin', executable), |
113 os.path.join(sdk_root, 'bin')) | 111 os.path.join(sdk_root, 'bin')) |
114 | 112 |
115 | 113 |
116 def CopySnapshots(snapshots, sdk_root): | 114 def CopySnapshots(snapshots, sdk_root): |
117 for snapshot in ['dart2js', 'dartfmt', 'utils_wrapper', 'pub']: | 115 for snapshot in ['dart2js', 'dartanalyzer', 'dartfmt', 'utils_wrapper', |
| 116 'pub']: |
118 snapshot += '.dart.snapshot' | 117 snapshot += '.dart.snapshot' |
119 copyfile(join(snapshots, snapshot), | 118 copyfile(join(snapshots, snapshot), |
120 join(sdk_root, 'bin', 'snapshots', snapshot)) | 119 join(sdk_root, 'bin', 'snapshots', snapshot)) |
121 | 120 |
122 | 121 |
123 def Main(argv): | 122 def Main(argv): |
124 # Pull in all of the gypi files which will be munged into the sdk. | 123 # Pull in all of the gypi files which will be munged into the sdk. |
125 HOME = dirname(dirname(realpath(__file__))) | 124 HOME = dirname(dirname(realpath(__file__))) |
126 | 125 |
127 (options, args) = GetOptions() | 126 (options, args) = GetOptions() |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 '.gitignore')) | 213 '.gitignore')) |
215 | 214 |
216 # Copy lib/_internal/libraries.dart. | 215 # Copy lib/_internal/libraries.dart. |
217 copyfile(join(HOME, 'sdk', 'lib', '_internal', 'libraries.dart'), | 216 copyfile(join(HOME, 'sdk', 'lib', '_internal', 'libraries.dart'), |
218 join(LIB, '_internal', 'libraries.dart')) | 217 join(LIB, '_internal', 'libraries.dart')) |
219 | 218 |
220 # Create and copy tools. | 219 # Create and copy tools. |
221 UTIL = join(SDK_tmp, 'util') | 220 UTIL = join(SDK_tmp, 'util') |
222 os.makedirs(UTIL) | 221 os.makedirs(UTIL) |
223 | 222 |
224 # Create and copy dartanalyzer into 'util' | |
225 DARTANALYZER_SRC = join(HOME, build_dir, 'dartanalyzer') | |
226 DARTANALYZER_DEST = join(UTIL, 'dartanalyzer') | |
227 os.makedirs(DARTANALYZER_DEST) | |
228 | |
229 jarFiles = glob.glob(join(DARTANALYZER_SRC, '*.jar')) | |
230 | |
231 for jarFile in jarFiles: | |
232 copyfile(jarFile, join(DARTANALYZER_DEST, os.path.basename(jarFile))) | |
233 | |
234 RESOURCE = join(SDK_tmp, 'lib', '_internal', 'pub', 'asset') | 223 RESOURCE = join(SDK_tmp, 'lib', '_internal', 'pub', 'asset') |
235 os.makedirs(os.path.dirname(RESOURCE)) | 224 os.makedirs(os.path.dirname(RESOURCE)) |
236 copytree(join(HOME, 'sdk', 'lib', '_internal', 'pub', 'asset'), | 225 copytree(join(HOME, 'sdk', 'lib', '_internal', 'pub', 'asset'), |
237 join(RESOURCE), | 226 join(RESOURCE), |
238 ignore=ignore_patterns('.svn')) | 227 ignore=ignore_patterns('.svn')) |
239 | 228 |
240 # Copy in 7zip for Windows. | 229 # Copy in 7zip for Windows. |
241 if HOST_OS == 'win32': | 230 if HOST_OS == 'win32': |
242 copytree(join(HOME, 'third_party', '7zip'), | 231 copytree(join(HOME, 'third_party', '7zip'), |
243 join(RESOURCE, '7zip'), | 232 join(RESOURCE, '7zip'), |
(...skipping 16 matching lines...) Expand all Loading... |
260 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: | 249 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: |
261 f.write(revision + '\n') | 250 f.write(revision + '\n') |
262 f.close() | 251 f.close() |
263 | 252 |
264 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) | 253 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) |
265 | 254 |
266 move(SDK_tmp, SDK) | 255 move(SDK_tmp, SDK) |
267 | 256 |
268 if __name__ == '__main__': | 257 if __name__ == '__main__': |
269 sys.exit(Main(sys.argv)) | 258 sys.exit(Main(sys.argv)) |
OLD | NEW |