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