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 # |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 # ......unittest/ | 48 # ......unittest/ |
49 # ......(more will come here) | 49 # ......(more will come here) |
50 # ....util/ | 50 # ....util/ |
51 # ......analyzer/ | 51 # ......analyzer/ |
52 # ........dart_analyzer.jar | 52 # ........dart_analyzer.jar |
53 # ........(third-party libraries for dart_analyzer) | 53 # ........(third-party libraries for dart_analyzer) |
54 # ......pub/ | 54 # ......pub/ |
55 # ......(more will come here) | 55 # ......(more will come here) |
56 | 56 |
57 | 57 |
| 58 import glob |
58 import optparse | 59 import optparse |
59 import os | 60 import os |
60 import re | 61 import re |
61 import sys | 62 import sys |
62 import subprocess | 63 import subprocess |
63 import tempfile | 64 import tempfile |
64 import utils | 65 import utils |
65 | 66 |
66 HOST_OS = utils.GuessOS() | 67 HOST_OS = utils.GuessOS() |
67 | 68 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 if HOST_OS == 'win32': | 107 if HOST_OS == 'win32': |
107 file_extension = '.bat' | 108 file_extension = '.bat' |
108 | 109 |
109 src = src_file + file_extension | 110 src = src_file + file_extension |
110 dest = join(dest_dir, basename(src_file) + file_extension) | 111 dest = join(dest_dir, basename(src_file) + file_extension) |
111 Copy(src, dest) | 112 Copy(src, dest) |
112 | 113 |
113 | 114 |
114 def CopyDartScripts(home, sdk_root): | 115 def CopyDartScripts(home, sdk_root): |
115 # TODO(dgrove) - add pub once issue 6619 is fixed | 116 # TODO(dgrove) - add pub once issue 6619 is fixed |
116 for executable in ['dart2js', 'dartdoc']: | 117 for executable in ['dart2js', 'dartanalyzer', 'dartdoc']: |
117 CopyShellScript(os.path.join(home, 'sdk', 'bin', executable), | 118 CopyShellScript(os.path.join(home, 'sdk', 'bin', executable), |
118 os.path.join(sdk_root, 'bin')) | 119 os.path.join(sdk_root, 'bin')) |
119 | 120 |
120 | 121 |
121 def CopySnapshots(snapshot, sdk_root): | 122 def CopySnapshots(snapshot, sdk_root): |
122 copyfile(snapshot, join(sdk_root, 'bin', 'snapshots', basename(snapshot))) | 123 copyfile(snapshot, join(sdk_root, 'bin', 'snapshots', basename(snapshot))) |
123 | 124 |
124 | 125 |
125 def Main(argv): | 126 def Main(argv): |
126 # Pull in all of the gypi files which will be munged into the sdk. | 127 # Pull in all of the gypi files which will be munged into the sdk. |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 jarsToCopy = [ join("args4j", "2.0.12", "args4j-2.0.12.jar"), | 256 jarsToCopy = [ join("args4j", "2.0.12", "args4j-2.0.12.jar"), |
256 join("guava", "r13", "guava-13.0.1.jar"), | 257 join("guava", "r13", "guava-13.0.1.jar"), |
257 join("json", "r2_20080312", "json.jar") ] | 258 join("json", "r2_20080312", "json.jar") ] |
258 for jarToCopy in jarsToCopy: | 259 for jarToCopy in jarsToCopy: |
259 dest_dir = join (ANALYZER_DEST, os.path.dirname(jarToCopy)) | 260 dest_dir = join (ANALYZER_DEST, os.path.dirname(jarToCopy)) |
260 os.makedirs(dest_dir) | 261 os.makedirs(dest_dir) |
261 dest_file = join (ANALYZER_DEST, jarToCopy) | 262 dest_file = join (ANALYZER_DEST, jarToCopy) |
262 src_file = join(ANALYZER_HOME, 'util', 'analyzer', jarToCopy) | 263 src_file = join(ANALYZER_HOME, 'util', 'analyzer', jarToCopy) |
263 copyfile(src_file, dest_file) | 264 copyfile(src_file, dest_file) |
264 | 265 |
| 266 # Create and copy dartanalyzer into 'util' |
| 267 DARTANALYZER_SRC = join(HOME, build_dir, 'dartanalyzer') |
| 268 DARTANALYZER_DEST = join(UTIL, 'dartanalyzer') |
| 269 os.makedirs(DARTANALYZER_DEST) |
| 270 |
| 271 jarFiles = glob.glob(join(DARTANALYZER_SRC, '*.jar')) |
| 272 |
| 273 for jarFile in jarFiles: |
| 274 copyfile(jarFile, join(DARTANALYZER_DEST, os.path.basename(jarFile))) |
| 275 |
265 # Create and populate util/pub. | 276 # Create and populate util/pub. |
266 copytree(join(HOME, 'utils', 'pub'), join(UTIL, 'pub'), | 277 copytree(join(HOME, 'utils', 'pub'), join(UTIL, 'pub'), |
267 ignore=ignore_patterns('.svn', 'sdk')) | 278 ignore=ignore_patterns('.svn', 'sdk')) |
268 | 279 |
269 # Copy in 7zip for Windows. | 280 # Copy in 7zip for Windows. |
270 if HOST_OS == 'win32': | 281 if HOST_OS == 'win32': |
271 copytree(join(HOME, 'third_party', '7zip'), | 282 copytree(join(HOME, 'third_party', '7zip'), |
272 join(join(UTIL, 'pub'), '7zip'), | 283 join(join(UTIL, 'pub'), '7zip'), |
273 ignore=ignore_patterns('.svn')) | 284 ignore=ignore_patterns('.svn')) |
274 | 285 |
(...skipping 21 matching lines...) Expand all Loading... |
296 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: | 307 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: |
297 f.write(revision + '\n') | 308 f.write(revision + '\n') |
298 f.close() | 309 f.close() |
299 | 310 |
300 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) | 311 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) |
301 | 312 |
302 move(SDK_tmp, SDK) | 313 move(SDK_tmp, SDK) |
303 | 314 |
304 if __name__ == '__main__': | 315 if __name__ == '__main__': |
305 sys.exit(Main(sys.argv)) | 316 sys.exit(Main(sys.argv)) |
OLD | NEW |