| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 using the appropriate platform-specific file extension.''' | 113 using the appropriate platform-specific file extension.''' |
| 114 file_extension = '' | 114 file_extension = '' |
| 115 if utils.GuessOS() == 'win32': | 115 if utils.GuessOS() == 'win32': |
| 116 file_extension = '.bat' | 116 file_extension = '.bat' |
| 117 | 117 |
| 118 src = src_file + file_extension | 118 src = src_file + file_extension |
| 119 dest = join(dest_dir, basename(src_file) + file_extension) | 119 dest = join(dest_dir, basename(src_file) + file_extension) |
| 120 Copy(src, dest) | 120 Copy(src, dest) |
| 121 | 121 |
| 122 | 122 |
| 123 def CopyDart2Js(build_dir, sdk_root): | 123 def CopyDart2Js(build_dir, sdk_root, revision): |
| 124 ''' | 124 ''' |
| 125 Install dart2js in SDK/lib/dart2js. | 125 Install dart2js in SDK/lib/dart2js. |
| 126 | 126 |
| 127 Currently, we copy too much stuff to this location, but the SDK's | 127 Currently, we copy too much stuff to this location, but the SDK's |
| 128 layout matches the the layout of the part of the repository we're | 128 layout matches the the layout of the part of the repository we're |
| 129 dealing with here which frees us from rewriting files. The long term | 129 dealing with here which frees us from rewriting files. The long term |
| 130 plan is to align the layout of the repository and the SDK, at which | 130 plan is to align the layout of the repository and the SDK, at which |
| 131 point we should be able to simplify Main below and share the dart | 131 point we should be able to simplify Main below and share the dart |
| 132 files between the various components to minimize SDK download size. | 132 files between the various components to minimize SDK download size. |
| 133 ''' | 133 ''' |
| 134 copytree('lib', os.path.join(sdk_root, 'lib', 'dart2js', 'lib'), | 134 dart2js_lib = os.path.join(sdk_root, 'lib', 'dart2js', 'lib') |
| 135 ignore=ignore_patterns('.svn')) | 135 copytree('lib', dart2js_lib, ignore=ignore_patterns('.svn')) |
| 136 copytree(os.path.join('runtime', 'lib'), | 136 copytree(os.path.join('runtime', 'lib'), |
| 137 os.path.join(sdk_root, 'lib', 'dart2js', 'runtime', 'lib'), | 137 os.path.join(sdk_root, 'lib', 'dart2js', 'runtime', 'lib'), |
| 138 ignore=ignore_patterns('.svn')) | 138 ignore=ignore_patterns('.svn')) |
| 139 copytree(os.path.join('runtime', 'bin'), | 139 copytree(os.path.join('runtime', 'bin'), |
| 140 os.path.join(sdk_root, 'lib', 'dart2js', 'runtime', 'bin'), | 140 os.path.join(sdk_root, 'lib', 'dart2js', 'runtime', 'bin'), |
| 141 ignore=ignore_patterns('.svn')) | 141 ignore=ignore_patterns('.svn')) |
| 142 if revision: |
| 143 ReplaceInFiles([os.path.join(dart2js_lib, |
| 144 'compiler/implementation/compiler.dart')], |
| 145 [(r"BUILD_ID = 'build number could not be determined'", |
| 146 r"BUILD_ID = '%s'" % revision)]) |
| 142 if utils.GuessOS() == 'win32': | 147 if utils.GuessOS() == 'win32': |
| 143 dart2js = os.path.join(sdk_root, 'bin', 'dart2js.bat') | 148 dart2js = os.path.join(sdk_root, 'bin', 'dart2js.bat') |
| 144 Copy(os.path.join(build_dir, 'dart2js.bat'), dart2js) | 149 Copy(os.path.join(build_dir, 'dart2js.bat'), dart2js) |
| 145 ReplaceInFiles([dart2js], | 150 ReplaceInFiles([dart2js], |
| 146 [(r'%SCRIPTPATH%\.\.\\lib', | 151 [(r'%SCRIPTPATH%\.\.\\lib', |
| 147 r'%SCRIPTPATH%..\lib\dart2js\lib')]) | 152 r'%SCRIPTPATH%..\lib\dart2js\lib')]) |
| 148 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc.bat') | 153 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc.bat') |
| 149 Copy(os.path.join(build_dir, 'dartdoc.bat'), dartdoc) | 154 Copy(os.path.join(build_dir, 'dartdoc.bat'), dartdoc) |
| 150 else: | 155 else: |
| 151 dart2js = os.path.join(sdk_root, 'bin', 'dart2js') | 156 dart2js = os.path.join(sdk_root, 'bin', 'dart2js') |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 ignore=ignore_patterns('.svn', 'sdk')) | 376 ignore=ignore_patterns('.svn', 'sdk')) |
| 372 | 377 |
| 373 # Copy import maps. | 378 # Copy import maps. |
| 374 PLATFORMS = ['any', 'vm', 'dartium', 'dart2js' ] | 379 PLATFORMS = ['any', 'vm', 'dartium', 'dart2js' ] |
| 375 os.makedirs(join(LIB, 'config')) | 380 os.makedirs(join(LIB, 'config')) |
| 376 for platform in PLATFORMS: | 381 for platform in PLATFORMS: |
| 377 import_src = join(HOME, 'lib', 'config', 'import_' + platform + '.config') | 382 import_src = join(HOME, 'lib', 'config', 'import_' + platform + '.config') |
| 378 import_dst = join(LIB, 'config', 'import_' + platform + '.config') | 383 import_dst = join(LIB, 'config', 'import_' + platform + '.config') |
| 379 copyfile(import_src, import_dst); | 384 copyfile(import_src, import_dst); |
| 380 | 385 |
| 386 revision = utils.GetSVNRevision() |
| 387 |
| 381 # Copy dart2js. | 388 # Copy dart2js. |
| 382 CopyDart2Js(build_dir, SDK_tmp) | 389 CopyDart2Js(build_dir, SDK_tmp, revision) |
| 383 | 390 |
| 384 # Write the 'revision' file | 391 # Write the 'revision' file |
| 385 revision = utils.GetSVNRevision() | |
| 386 if revision is not None: | 392 if revision is not None: |
| 387 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: | 393 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: |
| 388 f.write(revision + '\n') | 394 f.write(revision + '\n') |
| 389 f.close() | 395 f.close() |
| 390 | 396 |
| 391 move(SDK_tmp, SDK) | 397 move(SDK_tmp, SDK) |
| 392 utils.Touch(os.path.join(SDK, 'create.stamp')) | 398 utils.Touch(os.path.join(SDK, 'create.stamp')) |
| 393 | 399 |
| 394 if __name__ == '__main__': | 400 if __name__ == '__main__': |
| 395 sys.exit(Main(sys.argv)) | 401 sys.exit(Main(sys.argv)) |
| OLD | NEW |