| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2011, 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 # ..sdk/ | 14 # ..dart-sdk/ |
| 15 # ....bin/ | 15 # ....bin/ |
| 16 # ......dart or dart.exe (executable) | 16 # ......dart or dart.exe (executable) |
| 17 # ......frogc.dart | 17 # ......frogc.dart |
| 18 # ......frogsh (coming later) | 18 # ......frogsh (coming later) |
| 19 # ....lib/ | 19 # ....lib/ |
| 20 # ......builtin/ | 20 # ......builtin/ |
| 21 # ........builtin_runtime.dart | 21 # ........builtin_runtime.dart |
| 22 # ........runtime/ | 22 # ........runtime/ |
| 23 # ......core/ | 23 # ......core/ |
| 24 # ........core_{compiler, frog, runtime}.dart | 24 # ........core_{compiler, frog, runtime}.dart |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 ['variables']['jsonlib_resources'] | 77 ['variables']['jsonlib_resources'] |
| 78 json_frog_sources = \ | 78 json_frog_sources = \ |
| 79 (eval(open("frog/lib/frog_json_sources.gypi").read()))['sources'] | 79 (eval(open("frog/lib/frog_json_sources.gypi").read()))['sources'] |
| 80 | 80 |
| 81 HOME = dirname(dirname(realpath(__file__))) | 81 HOME = dirname(dirname(realpath(__file__))) |
| 82 | 82 |
| 83 SDK_tmp = tempfile.mkdtemp() | 83 SDK_tmp = tempfile.mkdtemp() |
| 84 SDK = argv[1] | 84 SDK = argv[1] |
| 85 | 85 |
| 86 # TODO(dgrove) - deal with architectures that are not ia32. | 86 # TODO(dgrove) - deal with architectures that are not ia32. |
| 87 if (os.path.basename(os.path.dirname(SDK)) != | |
| 88 utils.GetBuildConf('release', 'ia32')): | |
| 89 print "SDK is not built in Debug mode." | |
| 90 if not os.path.exists(SDK): | |
| 91 # leave empty dir behind | |
| 92 os.makedirs(SDK) | |
| 93 exit(0) | |
| 94 | 87 |
| 95 if exists(SDK): | 88 if exists(SDK): |
| 96 rmtree(SDK) | 89 rmtree(SDK) |
| 97 | 90 |
| 98 # Create and populate sdk/bin. | 91 # Create and populate sdk/bin. |
| 99 BIN = join(SDK_tmp, 'bin') | 92 BIN = join(SDK_tmp, 'bin') |
| 100 os.makedirs(BIN) | 93 os.makedirs(BIN) |
| 101 | 94 |
| 102 # Copy the Dart VM binary into sdk/bin. | 95 # Copy the Dart VM binary into sdk/bin. |
| 103 # TODO(dgrove) - deal with architectures that are not ia32. | 96 # TODO(dgrove) - deal with architectures that are not ia32. |
| 104 build_dir = utils.GetBuildRoot(utils.GuessOS(), 'release', 'ia32') | 97 build_dir = os.path.dirname(argv[1]) |
| 105 if utils.GuessOS() == 'win32': | 98 if utils.GuessOS() == 'win32': |
| 106 # TODO(dgrove) - deal with frogc.bat | 99 # TODO(dgrove) - deal with frogc.bat |
| 107 dart_src_binary = join(HOME, build_dir, 'dart.exe') | 100 dart_src_binary = join(HOME, build_dir, 'dart.exe') |
| 108 dart_dest_binary = join(BIN, 'dart.exe') | 101 dart_dest_binary = join(BIN, 'dart.exe') |
| 109 else: | 102 else: |
| 110 frogc_src_binary = join(HOME, 'frog', 'frogc') | 103 frogc_src_binary = join(HOME, 'frog', 'frogc') |
| 111 dart_src_binary = join(HOME, build_dir, 'dart') | 104 dart_src_binary = join(HOME, build_dir, 'dart') |
| 112 dart_dest_binary = join(BIN, 'dart') | 105 dart_dest_binary = join(BIN, 'dart') |
| 113 frogc_dest_binary = join(BIN, 'frogc') | 106 frogc_dest_binary = join(BIN, 'frogc') |
| 114 copyfile(dart_src_binary, dart_dest_binary) | 107 copyfile(dart_src_binary, dart_dest_binary) |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 dest_file.close() | 366 dest_file.close() |
| 374 | 367 |
| 375 # Create and copy tools. | 368 # Create and copy tools. |
| 376 | 369 |
| 377 UTIL = join(SDK_tmp, 'util') | 370 UTIL = join(SDK_tmp, 'util') |
| 378 os.makedirs(UTIL) | 371 os.makedirs(UTIL) |
| 379 | 372 |
| 380 copytree(join(HOME, 'utils', 'dartdoc'), join(UTIL, 'dartdoc'), | 373 copytree(join(HOME, 'utils', 'dartdoc'), join(UTIL, 'dartdoc'), |
| 381 ignore=ignore_patterns('.svn')) | 374 ignore=ignore_patterns('.svn')) |
| 382 | 375 |
| 383 copytree(SDK_tmp, SDK) | 376 move(SDK_tmp, SDK) |
| 384 rmtree(SDK_tmp) | |
| 385 | 377 |
| 386 if __name__ == '__main__': | 378 if __name__ == '__main__': |
| 387 sys.exit(Main(sys.argv)) | 379 sys.exit(Main(sys.argv)) |
| OLD | NEW |