| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 using the appropriate platform-specific file extension.''' | 96 using the appropriate platform-specific file extension.''' |
| 97 file_extension = '' | 97 file_extension = '' |
| 98 if utils.GuessOS() == 'win32': | 98 if utils.GuessOS() == 'win32': |
| 99 file_extension = '.bat' | 99 file_extension = '.bat' |
| 100 | 100 |
| 101 src = src_file + file_extension | 101 src = src_file + file_extension |
| 102 dest = join(dest_dir, basename(src_file) + file_extension) | 102 dest = join(dest_dir, basename(src_file) + file_extension) |
| 103 Copy(src, dest) | 103 Copy(src, dest) |
| 104 | 104 |
| 105 | 105 |
| 106 def CopyDart2Js(build_dir, sdk_root, revision): | 106 def CopyDart2Js(build_dir, sdk_root, version): |
| 107 if revision: | 107 if version: |
| 108 ReplaceInFiles([os.path.join(sdk_root, 'pkg', 'compiler', | 108 ReplaceInFiles([os.path.join(sdk_root, 'pkg', 'compiler', |
| 109 'implementation', 'compiler.dart')], | 109 'implementation', 'compiler.dart')], |
| 110 [(r"BUILD_ID = 'build number could not be determined'", | 110 [(r"BUILD_ID = 'build number could not be determined'", |
| 111 r"BUILD_ID = '%s'" % revision)]) | 111 r"BUILD_ID = '%s'" % version)]) |
| 112 if utils.GuessOS() == 'win32': | 112 if utils.GuessOS() == 'win32': |
| 113 dart2js = os.path.join(sdk_root, 'bin', 'dart2js.bat') | 113 dart2js = os.path.join(sdk_root, 'bin', 'dart2js.bat') |
| 114 Copy(os.path.join(build_dir, 'dart2js.bat'), dart2js) | 114 Copy(os.path.join(build_dir, 'dart2js.bat'), dart2js) |
| 115 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc.bat') | 115 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc.bat') |
| 116 Copy(os.path.join(build_dir, 'dartdoc.bat'), dartdoc) | 116 Copy(os.path.join(build_dir, 'dartdoc.bat'), dartdoc) |
| 117 # TODO(dgrove) - fix this once issue 4788 is addressed. | 117 # TODO(dgrove) - fix this once issue 4788 is addressed. |
| 118 ReplaceInFiles([dart2js], | 118 ReplaceInFiles([dart2js], |
| 119 [(r'%SCRIPTPATH%\.\.\\\.\.\\lib', r'%SCRIPTPATH%..\\pkg')]); | 119 [(r'%SCRIPTPATH%\.\.\\\.\.\\lib', r'%SCRIPTPATH%..\\pkg')]); |
| 120 ReplaceInFiles([dartdoc], | 120 ReplaceInFiles([dartdoc], |
| 121 [(r'%SCRIPTPATH%\.\.\\\.\.\\pkg', r'%SCRIPTPATH%..\\pkg')]); | 121 [(r'%SCRIPTPATH%\.\.\\\.\.\\pkg', r'%SCRIPTPATH%..\\pkg')]); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 join(join(UTIL, 'pub'), '7zip'), | 311 join(join(UTIL, 'pub'), '7zip'), |
| 312 ignore=ignore_patterns('.svn')) | 312 ignore=ignore_patterns('.svn')) |
| 313 | 313 |
| 314 ReplaceInFiles([ | 314 ReplaceInFiles([ |
| 315 join(UTIL, 'pub', 'io.dart'), | 315 join(UTIL, 'pub', 'io.dart'), |
| 316 ], [ | 316 ], [ |
| 317 ("var pathTo7zip = '../../third_party/7zip/7za.exe';", | 317 ("var pathTo7zip = '../../third_party/7zip/7za.exe';", |
| 318 "var pathTo7zip = '7zip/7za.exe';"), | 318 "var pathTo7zip = '7zip/7za.exe';"), |
| 319 ]) | 319 ]) |
| 320 | 320 |
| 321 revision = utils.GetSVNRevision() | 321 version = utils.GetVersion() |
| 322 | 322 |
| 323 # Copy dart2js. | 323 # Copy dart2js. |
| 324 CopyDart2Js(build_dir, SDK_tmp, revision) | 324 CopyDart2Js(build_dir, SDK_tmp, version) |
| 325 | 325 |
| 326 # Write the 'revision' file | 326 # Write the 'version' file |
| 327 if revision is not None: | 327 if version is not None: |
| 328 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: | 328 with open(os.path.join(SDK_tmp, 'version'), 'w') as f: |
| 329 f.write(revision + '\n') | 329 f.write(version + '\n') |
| 330 f.close() | 330 f.close() |
| 331 | 331 |
| 332 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) | 332 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) |
| 333 | 333 |
| 334 move(SDK_tmp, SDK) | 334 move(SDK_tmp, SDK) |
| 335 | 335 |
| 336 if __name__ == '__main__': | 336 if __name__ == '__main__': |
| 337 sys.exit(Main(sys.argv)) | 337 sys.exit(Main(sys.argv)) |
| OLD | NEW |