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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 copyfile(join('runtime', 'lib', filename), | 366 copyfile(join('runtime', 'lib', filename), |
367 join(corelib_dest_dir, 'runtime', filename)) | 367 join(corelib_dest_dir, 'runtime', filename)) |
368 | 368 |
369 # | 369 # |
370 # At this point, it's time to create lib/core/core*dart . | 370 # At this point, it's time to create lib/core/core*dart . |
371 # | 371 # |
372 # construct lib/core_runtime.dart from whole cloth. | 372 # construct lib/core_runtime.dart from whole cloth. |
373 dest_file = open(join(corelib_dest_dir, 'core_runtime.dart'), 'w') | 373 dest_file = open(join(corelib_dest_dir, 'core_runtime.dart'), 'w') |
374 dest_file.write('#library("dart:core");\n') | 374 dest_file.write('#library("dart:core");\n') |
375 dest_file.write('#import("dart:coreimpl");\n') | 375 dest_file.write('#import("dart:coreimpl");\n') |
| 376 dest_file.write('#import("dart:math");\n') |
376 for filename in corelib_sources: | 377 for filename in corelib_sources: |
377 dest_file.write('#source("runtime/' + filename + '");\n') | 378 dest_file.write('#source("runtime/' + filename + '");\n') |
378 for filename in corelib_runtime_sources: | 379 for filename in corelib_runtime_sources: |
379 if filename.endswith('.dart'): | 380 if filename.endswith('.dart'): |
380 dest_file.write('#source("runtime/' + filename + '");\n') | 381 dest_file.write('#source("runtime/' + filename + '");\n') |
381 # include the missing print function | 382 # include the missing print function |
382 dest_file.write('void print(Object arg) { /* native */ }\n') | 383 dest_file.write('void print(Object arg) { /* native */ }\n') |
383 dest_file.close() | 384 dest_file.close() |
384 | 385 |
385 # | 386 # |
386 # Create and populate lib/coreimpl. | 387 # Create and populate lib/coreimpl. |
387 # | 388 # |
388 | 389 |
389 # First, copy corelib/src/implementation to corelib/runtime. | 390 # First, copy corelib/src/implementation to corelib/runtime. |
390 for filename in coreimpl_sources: | 391 for filename in coreimpl_sources: |
391 for target_dir in ['runtime']: | 392 for target_dir in ['runtime']: |
392 copyfile(join('corelib', 'src', 'implementation', filename), | 393 copyfile(join('corelib', 'src', 'implementation', filename), |
393 join(coreimpl_dest_dir, target_dir, filename)) | 394 join(coreimpl_dest_dir, target_dir, filename)) |
394 | 395 |
395 for filename in coreimpl_runtime_sources: | 396 for filename in coreimpl_runtime_sources: |
396 if filename.endswith('.dart') and not filename.endswith('_patch.dart'): | 397 if filename.endswith('.dart') and not filename.endswith('_patch.dart'): |
397 copyfile(join('runtime', 'lib', filename), | 398 copyfile(join('runtime', 'lib', filename), |
398 join(coreimpl_dest_dir, 'runtime', filename)) | 399 join(coreimpl_dest_dir, 'runtime', filename)) |
399 | 400 |
400 # Construct lib/coreimpl/coreimpl_runtime.dart from whole cloth. | 401 # Construct lib/coreimpl/coreimpl_runtime.dart from whole cloth. |
401 dest_file = open(join(coreimpl_dest_dir, 'coreimpl_runtime.dart'), 'w') | 402 dest_file = open(join(coreimpl_dest_dir, 'coreimpl_runtime.dart'), 'w') |
402 dest_file.write('#library("dart:coreimpl");\n') | 403 dest_file.write('#library("dart:coreimpl");\n') |
| 404 dest_file.write('#import("dart:math");\n') |
403 for filename in coreimpl_sources: | 405 for filename in coreimpl_sources: |
404 dest_file.write('#source("runtime/' + filename + '");\n') | 406 dest_file.write('#source("runtime/' + filename + '");\n') |
405 for filename in coreimpl_runtime_sources: | 407 for filename in coreimpl_runtime_sources: |
406 if filename.endswith('.dart') and not filename.endswith('_patch.dart'): | 408 if filename.endswith('.dart') and not filename.endswith('_patch.dart'): |
407 dest_file.write('#source("runtime/' + filename + '");\n') | 409 dest_file.write('#source("runtime/' + filename + '");\n') |
408 dest_file.close() | 410 dest_file.close() |
409 | 411 |
410 | 412 |
411 # Create and copy pkg. | 413 # Create and copy pkg. |
412 PKG = join(SDK_tmp, 'pkg') | 414 PKG = join(SDK_tmp, 'pkg') |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 if revision is not None: | 491 if revision is not None: |
490 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: | 492 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: |
491 f.write(revision + '\n') | 493 f.write(revision + '\n') |
492 f.close() | 494 f.close() |
493 | 495 |
494 move(SDK_tmp, SDK) | 496 move(SDK_tmp, SDK) |
495 utils.Touch(os.path.join(SDK, 'create.stamp')) | 497 utils.Touch(os.path.join(SDK, 'create.stamp')) |
496 | 498 |
497 if __name__ == '__main__': | 499 if __name__ == '__main__': |
498 sys.exit(Main(sys.argv)) | 500 sys.exit(Main(sys.argv)) |
OLD | NEW |