| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 def CopyDart2Js(build_dir, sdk_root, revision): | 103 def CopyDart2Js(build_dir, sdk_root, revision): |
| 104 if revision: | 104 if revision: |
| 105 ReplaceInFiles([os.path.join(sdk_root, 'lib', 'compiler', | 105 ReplaceInFiles([os.path.join(sdk_root, 'lib', 'compiler', |
| 106 'implementation', 'compiler.dart')], | 106 'implementation', 'compiler.dart')], |
| 107 [(r"BUILD_ID = 'build number could not be determined'", | 107 [(r"BUILD_ID = 'build number could not be determined'", |
| 108 r"BUILD_ID = '%s'" % revision)]) | 108 r"BUILD_ID = '%s'" % revision)]) |
| 109 if utils.GuessOS() == 'win32': | 109 if utils.GuessOS() == 'win32': |
| 110 dart2js = os.path.join(sdk_root, 'bin', 'dart2js.bat') | 110 dart2js = os.path.join(sdk_root, 'bin', 'dart2js.bat') |
| 111 Copy(os.path.join(build_dir, 'dart2js.bat'), dart2js) | 111 Copy(os.path.join(build_dir, 'dart2js.bat'), dart2js) |
| 112 ReplaceInFiles([dart2js], | |
| 113 [(r'%SCRIPTPATH%\.\.\\lib', | |
| 114 r'%SCRIPTPATH%..\lib')]) | |
| 115 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc.bat') | 112 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc.bat') |
| 116 Copy(os.path.join(build_dir, 'dartdoc.bat'), dartdoc) | 113 Copy(os.path.join(build_dir, 'dartdoc.bat'), dartdoc) |
| 117 else: | 114 else: |
| 118 dart2js = os.path.join(sdk_root, 'bin', 'dart2js') | 115 dart2js = os.path.join(sdk_root, 'bin', 'dart2js') |
| 119 Copy(os.path.join(build_dir, 'dart2js'), dart2js) | 116 Copy(os.path.join(build_dir, 'dart2js'), dart2js) |
| 120 ReplaceInFiles([dart2js], | |
| 121 [(r'\$BIN_DIR/\.\./\.\./lib', | |
| 122 r'$BIN_DIR/../lib')]) | |
| 123 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc') | 117 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc') |
| 124 Copy(os.path.join(build_dir, 'dartdoc'), dartdoc) | 118 Copy(os.path.join(build_dir, 'dartdoc'), dartdoc) |
| 119 ReplaceInFiles([dart2js, dartdoc], |
| 120 [(r'\$BIN_DIR/\.\./\.\.', r'$BIN_DIR/..')]) |
| 125 | 121 |
| 126 | 122 |
| 127 def Main(argv): | 123 def Main(argv): |
| 128 # Pull in all of the gpyi files which will be munged into the sdk. | 124 # Pull in all of the gpyi files which will be munged into the sdk. |
| 129 io_runtime_sources = \ | 125 io_runtime_sources = \ |
| 130 (eval(open("runtime/bin/io_sources.gypi").read()))['sources'] | 126 (eval(open("runtime/bin/io_sources.gypi").read()))['sources'] |
| 131 | 127 |
| 132 HOME = dirname(dirname(realpath(__file__))) | 128 HOME = dirname(dirname(realpath(__file__))) |
| 133 | 129 |
| 134 SDK_tmp = tempfile.mkdtemp() | 130 SDK_tmp = tempfile.mkdtemp() |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 if revision is not None: | 285 if revision is not None: |
| 290 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: | 286 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: |
| 291 f.write(revision + '\n') | 287 f.write(revision + '\n') |
| 292 f.close() | 288 f.close() |
| 293 | 289 |
| 294 move(SDK_tmp, SDK) | 290 move(SDK_tmp, SDK) |
| 295 utils.Touch(os.path.join(SDK, 'create.stamp')) | 291 utils.Touch(os.path.join(SDK, 'create.stamp')) |
| 296 | 292 |
| 297 if __name__ == '__main__': | 293 if __name__ == '__main__': |
| 298 sys.exit(Main(sys.argv)) | 294 sys.exit(Main(sys.argv)) |
| OLD | NEW |