| 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 # ......dart2js | 18 # ......dart2js |
| 19 # ......dart_analyzer | 19 # ......dartanalyzer |
| 20 # ......pub | 20 # ......pub |
| 21 # ......snapshots/ | 21 # ......snapshots/ |
| 22 # ........utils_wrapper.dart.snapshot | 22 # ........utils_wrapper.dart.snapshot |
| 23 # ........pub.dart.snapshot | 23 # ........pub.dart.snapshot |
| 24 # ....include/ | 24 # ....include/ |
| 25 # ......dart_api.h | 25 # ......dart_api.h |
| 26 # ......dart_debugger_api.h | 26 # ......dart_debugger_api.h |
| 27 # ....lib/ | 27 # ....lib/ |
| 28 # ......_internal/ | 28 # ......_internal/ |
| 29 # ......async/ | 29 # ......async/ |
| (...skipping 12 matching lines...) Expand all Loading... |
| 42 # ......typed_data/ | 42 # ......typed_data/ |
| 43 # ....packages/ | 43 # ....packages/ |
| 44 # ......args/ | 44 # ......args/ |
| 45 # ......intl/ | 45 # ......intl/ |
| 46 # ......logging/ | 46 # ......logging/ |
| 47 # ......meta/ | 47 # ......meta/ |
| 48 # ......serialization | 48 # ......serialization |
| 49 # ......unittest/ | 49 # ......unittest/ |
| 50 # ......(more will come here) | 50 # ......(more will come here) |
| 51 # ....util/ | 51 # ....util/ |
| 52 # ......analyzer/ | |
| 53 # ........dart_analyzer.jar | |
| 54 # ......dartanalyzer/ | 52 # ......dartanalyzer/ |
| 55 # ........dartanalyzer.jar | 53 # ........dartanalyzer.jar |
| 56 # ........(third-party libraries for dart_analyzer) | 54 # ........(third-party libraries for dart_analyzer) |
| 57 # ......(more will come here) | 55 # ......(more will come here) |
| 58 | 56 |
| 59 | 57 |
| 60 import glob | 58 import glob |
| 61 import optparse | 59 import optparse |
| 62 import os | 60 import os |
| 63 import re | 61 import re |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 os.makedirs(BIN) | 151 os.makedirs(BIN) |
| 154 | 152 |
| 155 os.makedirs(join(BIN, 'snapshots')) | 153 os.makedirs(join(BIN, 'snapshots')) |
| 156 | 154 |
| 157 # Copy the Dart VM binary and the Windows Dart VM link library | 155 # Copy the Dart VM binary and the Windows Dart VM link library |
| 158 # into sdk/bin. | 156 # into sdk/bin. |
| 159 # | 157 # |
| 160 # TODO(dgrove) - deal with architectures that are not ia32. | 158 # TODO(dgrove) - deal with architectures that are not ia32. |
| 161 build_dir = os.path.dirname(SDK) | 159 build_dir = os.path.dirname(SDK) |
| 162 dart_file_extension = '' | 160 dart_file_extension = '' |
| 163 analyzer_file_extension = '' | |
| 164 if HOST_OS == 'win32': | 161 if HOST_OS == 'win32': |
| 165 dart_file_extension = '.exe' | 162 dart_file_extension = '.exe' |
| 166 analyzer_file_extension = '.bat' | |
| 167 dart_import_lib_src = join(HOME, build_dir, 'dart.lib') | 163 dart_import_lib_src = join(HOME, build_dir, 'dart.lib') |
| 168 dart_import_lib_dest = join(BIN, 'dart.lib') | 164 dart_import_lib_dest = join(BIN, 'dart.lib') |
| 169 copyfile(dart_import_lib_src, dart_import_lib_dest) | 165 copyfile(dart_import_lib_src, dart_import_lib_dest) |
| 170 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) | 166 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) |
| 171 dart_dest_binary = join(BIN, 'dart' + dart_file_extension) | 167 dart_dest_binary = join(BIN, 'dart' + dart_file_extension) |
| 172 copyfile(dart_src_binary, dart_dest_binary) | 168 copyfile(dart_src_binary, dart_dest_binary) |
| 173 copymode(dart_src_binary, dart_dest_binary) | 169 copymode(dart_src_binary, dart_dest_binary) |
| 174 # Strip the binaries on platforms where that is supported. | 170 # Strip the binaries on platforms where that is supported. |
| 175 if HOST_OS == 'linux': | 171 if HOST_OS == 'linux': |
| 176 subprocess.call(['strip', dart_dest_binary]) | 172 subprocess.call(['strip', dart_dest_binary]) |
| 177 elif HOST_OS == 'macos': | 173 elif HOST_OS == 'macos': |
| 178 subprocess.call(['strip', '-x', dart_dest_binary]) | 174 subprocess.call(['strip', '-x', dart_dest_binary]) |
| 179 | 175 |
| 180 # Copy analyzer into sdk/bin | |
| 181 ANALYZER_HOME = join(HOME, build_dir, 'analyzer') | |
| 182 dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin', | |
| 183 'dart_analyzer' + analyzer_file_extension) | |
| 184 dart_analyzer_dest_binary = join(BIN, | |
| 185 'dart_analyzer' + analyzer_file_extension) | |
| 186 copyfile(dart_analyzer_src_binary, dart_analyzer_dest_binary) | |
| 187 copymode(dart_analyzer_src_binary, dart_analyzer_dest_binary) | |
| 188 | |
| 189 # | 176 # |
| 190 # Create and populate sdk/include. | 177 # Create and populate sdk/include. |
| 191 # | 178 # |
| 192 INCLUDE = join(SDK_tmp, 'include') | 179 INCLUDE = join(SDK_tmp, 'include') |
| 193 os.makedirs(INCLUDE) | 180 os.makedirs(INCLUDE) |
| 194 copyfile(join(HOME, 'runtime', 'include', 'dart_api.h'), | 181 copyfile(join(HOME, 'runtime', 'include', 'dart_api.h'), |
| 195 join(INCLUDE, 'dart_api.h')) | 182 join(INCLUDE, 'dart_api.h')) |
| 196 copyfile(join(HOME, 'runtime', 'include', 'dart_debugger_api.h'), | 183 copyfile(join(HOME, 'runtime', 'include', 'dart_debugger_api.h'), |
| 197 join(INCLUDE, 'dart_debugger_api.h')) | 184 join(INCLUDE, 'dart_debugger_api.h')) |
| 198 | 185 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 for library in ['args', 'http', 'intl', 'logging', 'meta', 'oauth2', 'pathos', | 230 for library in ['args', 'http', 'intl', 'logging', 'meta', 'oauth2', 'pathos', |
| 244 'serialization', 'unittest', 'yaml', 'analyzer_experimental']: | 231 'serialization', 'unittest', 'yaml', 'analyzer_experimental']: |
| 245 | 232 |
| 246 copytree(join(HOME, 'pkg', library, 'lib'), join(PACKAGES, library), | 233 copytree(join(HOME, 'pkg', library, 'lib'), join(PACKAGES, library), |
| 247 ignore=ignore_patterns('*.svn')) | 234 ignore=ignore_patterns('*.svn')) |
| 248 | 235 |
| 249 # Create and copy tools. | 236 # Create and copy tools. |
| 250 UTIL = join(SDK_tmp, 'util') | 237 UTIL = join(SDK_tmp, 'util') |
| 251 os.makedirs(UTIL) | 238 os.makedirs(UTIL) |
| 252 | 239 |
| 253 # Create and copy Analyzer library into 'util' | |
| 254 ANALYZER_DEST = join(UTIL, 'analyzer') | |
| 255 os.makedirs(ANALYZER_DEST) | |
| 256 | |
| 257 analyzer_src_jar = join(ANALYZER_HOME, 'util', 'analyzer', | |
| 258 'dart_analyzer.jar') | |
| 259 analyzer_dest_jar = join(ANALYZER_DEST, 'dart_analyzer.jar') | |
| 260 copyfile(analyzer_src_jar, analyzer_dest_jar) | |
| 261 | |
| 262 jarsToCopy = [ join("args4j", "2.0.12", "args4j-2.0.12.jar"), | |
| 263 join("guava", "r13", "guava-13.0.1.jar"), | |
| 264 join("json", "r2_20080312", "json.jar") ] | |
| 265 for jarToCopy in jarsToCopy: | |
| 266 dest_dir = join (ANALYZER_DEST, os.path.dirname(jarToCopy)) | |
| 267 os.makedirs(dest_dir) | |
| 268 dest_file = join (ANALYZER_DEST, jarToCopy) | |
| 269 src_file = join(ANALYZER_HOME, 'util', 'analyzer', jarToCopy) | |
| 270 copyfile(src_file, dest_file) | |
| 271 | |
| 272 # Create and copy dartanalyzer into 'util' | 240 # Create and copy dartanalyzer into 'util' |
| 273 DARTANALYZER_SRC = join(HOME, build_dir, 'dartanalyzer') | 241 DARTANALYZER_SRC = join(HOME, build_dir, 'dartanalyzer') |
| 274 DARTANALYZER_DEST = join(UTIL, 'dartanalyzer') | 242 DARTANALYZER_DEST = join(UTIL, 'dartanalyzer') |
| 275 os.makedirs(DARTANALYZER_DEST) | 243 os.makedirs(DARTANALYZER_DEST) |
| 276 | 244 |
| 277 jarFiles = glob.glob(join(DARTANALYZER_SRC, '*.jar')) | 245 jarFiles = glob.glob(join(DARTANALYZER_SRC, '*.jar')) |
| 278 | 246 |
| 279 for jarFile in jarFiles: | 247 for jarFile in jarFiles: |
| 280 copyfile(jarFile, join(DARTANALYZER_DEST, os.path.basename(jarFile))) | 248 copyfile(jarFile, join(DARTANALYZER_DEST, os.path.basename(jarFile))) |
| 281 | 249 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 302 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: | 270 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: |
| 303 f.write(revision + '\n') | 271 f.write(revision + '\n') |
| 304 f.close() | 272 f.close() |
| 305 | 273 |
| 306 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) | 274 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) |
| 307 | 275 |
| 308 move(SDK_tmp, SDK) | 276 move(SDK_tmp, SDK) |
| 309 | 277 |
| 310 if __name__ == '__main__': | 278 if __name__ == '__main__': |
| 311 sys.exit(Main(sys.argv)) | 279 sys.exit(Main(sys.argv)) |
| OLD | NEW |