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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 # ........dart_analyzer.jar | 50 # ........dart_analyzer.jar |
51 # ........(third-party libraries for dart_analyzer) | 51 # ........(third-party libraries for dart_analyzer) |
52 # ......pub/ | 52 # ......pub/ |
53 # ......(more will come here) | 53 # ......(more will come here) |
54 | 54 |
55 | 55 |
56 | 56 |
57 import os | 57 import os |
58 import re | 58 import re |
59 import sys | 59 import sys |
| 60 import subprocess |
60 import tempfile | 61 import tempfile |
61 import utils | 62 import utils |
62 | 63 |
63 # TODO(dgrove): Only import modules following Google style guide. | 64 # TODO(dgrove): Only import modules following Google style guide. |
64 from os.path import basename, dirname, join, realpath, exists, isdir | 65 from os.path import basename, dirname, join, realpath, exists, isdir |
65 | 66 |
66 # TODO(dgrove): Only import modules following Google style guide. | 67 # TODO(dgrove): Only import modules following Google style guide. |
67 from shutil import copyfile, copymode, copytree, ignore_patterns, rmtree, move | 68 from shutil import copyfile, copymode, copytree, ignore_patterns, rmtree, move |
68 | 69 |
69 def ReplaceInFiles(paths, subs): | 70 def ReplaceInFiles(paths, subs): |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 if utils.GuessOS() == 'win32': | 161 if utils.GuessOS() == 'win32': |
161 dart_file_extension = '.exe' | 162 dart_file_extension = '.exe' |
162 analyzer_file_extension = '.bat' # TODO(zundel): test on Windows | 163 analyzer_file_extension = '.bat' # TODO(zundel): test on Windows |
163 dart_import_lib_src = join(HOME, build_dir, 'dart.lib') | 164 dart_import_lib_src = join(HOME, build_dir, 'dart.lib') |
164 dart_import_lib_dest = join(BIN, 'dart.lib') | 165 dart_import_lib_dest = join(BIN, 'dart.lib') |
165 copyfile(dart_import_lib_src, dart_import_lib_dest) | 166 copyfile(dart_import_lib_src, dart_import_lib_dest) |
166 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) | 167 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) |
167 dart_dest_binary = join(BIN, 'dart' + dart_file_extension) | 168 dart_dest_binary = join(BIN, 'dart' + dart_file_extension) |
168 copyfile(dart_src_binary, dart_dest_binary) | 169 copyfile(dart_src_binary, dart_dest_binary) |
169 copymode(dart_src_binary, dart_dest_binary) | 170 copymode(dart_src_binary, dart_dest_binary) |
| 171 if utils.GuessOS() != 'win32': |
| 172 subprocess.call(['strip', dart_dest_binary]) |
170 | 173 |
171 if ShouldCopyAnalyzer(): | 174 if ShouldCopyAnalyzer(): |
172 # Copy analyzer into sdk/bin | 175 # Copy analyzer into sdk/bin |
173 ANALYZER_HOME = join(HOME, build_dir, 'analyzer') | 176 ANALYZER_HOME = join(HOME, build_dir, 'analyzer') |
174 dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin', 'dart_analyzer') | 177 dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin', 'dart_analyzer') |
175 dart_analyzer_dest_binary = join(BIN, | 178 dart_analyzer_dest_binary = join(BIN, |
176 'dart_analyzer' + analyzer_file_extension) | 179 'dart_analyzer' + analyzer_file_extension) |
177 copyfile(dart_analyzer_src_binary, dart_analyzer_dest_binary) | 180 copyfile(dart_analyzer_src_binary, dart_analyzer_dest_binary) |
178 copymode(dart_analyzer_src_binary, dart_analyzer_dest_binary) | 181 copymode(dart_analyzer_src_binary, dart_analyzer_dest_binary) |
179 | 182 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: | 328 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: |
326 f.write(revision + '\n') | 329 f.write(revision + '\n') |
327 f.close() | 330 f.close() |
328 | 331 |
329 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) | 332 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) |
330 | 333 |
331 move(SDK_tmp, SDK) | 334 move(SDK_tmp, SDK) |
332 | 335 |
333 if __name__ == '__main__': | 336 if __name__ == '__main__': |
334 sys.exit(Main(sys.argv)) | 337 sys.exit(Main(sys.argv)) |
OLD | NEW |