| 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 17 matching lines...) Expand all Loading... |
| 28 # ......coreimpl/ | 28 # ......coreimpl/ |
| 29 # ......crypto/ | 29 # ......crypto/ |
| 30 # ......html/ | 30 # ......html/ |
| 31 # ......io/ | 31 # ......io/ |
| 32 # ......isolate/ | 32 # ......isolate/ |
| 33 # ......json/ | 33 # ......json/ |
| 34 # ......math/ | 34 # ......math/ |
| 35 # ......mirrors/ | 35 # ......mirrors/ |
| 36 # ......uri/ | 36 # ......uri/ |
| 37 # ......utf/ | 37 # ......utf/ |
| 38 # ......web/ | |
| 39 # ....pkg/ | 38 # ....pkg/ |
| 40 # ......args/ | 39 # ......args/ |
| 41 # ......dartdoc/ | 40 # ......dartdoc/ |
| 41 #.......htmlescape/ |
| 42 # ......intl/ | 42 # ......intl/ |
| 43 # ......logging/ | 43 # ......logging/ |
| 44 # ......unittest/ | 44 # ......unittest/ |
| 45 # ......(more will come here) | 45 # ......(more will come here) |
| 46 # ....util/ | 46 # ....util/ |
| 47 # ......analyzer/ | 47 # ......analyzer/ |
| 48 # ........dart_analyzer.jar | 48 # ........dart_analyzer.jar |
| 49 # ........(third-party libraries for dart_analyzer) | 49 # ........(third-party libraries for dart_analyzer) |
| 50 # ......pub/ | 50 # ......pub/ |
| 51 # ......(more will come here) | 51 # ......(more will come here) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 if utils.GuessOS() == 'win32': | 95 if utils.GuessOS() == 'win32': |
| 96 file_extension = '.bat' | 96 file_extension = '.bat' |
| 97 | 97 |
| 98 src = src_file + file_extension | 98 src = src_file + file_extension |
| 99 dest = join(dest_dir, basename(src_file) + file_extension) | 99 dest = join(dest_dir, basename(src_file) + file_extension) |
| 100 Copy(src, dest) | 100 Copy(src, dest) |
| 101 | 101 |
| 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], | 112 ReplaceInFiles([dart2js], |
| 113 [(r'%SCRIPTPATH%\.\.\\lib', | 113 [(r'%SCRIPTPATH%\.\.\\lib', |
| 114 r'%SCRIPTPATH%..\lib')]) | 114 r'%SCRIPTPATH%..\lib')]) |
| 115 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc.bat') | 115 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc.bat') |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 if filename == 'io.dart': | 213 if filename == 'io.dart': |
| 214 continue | 214 continue |
| 215 dest_file.write('#source("runtime/' + filename + '");\n') | 215 dest_file.write('#source("runtime/' + filename + '");\n') |
| 216 dest_file.close() | 216 dest_file.close() |
| 217 | 217 |
| 218 # | 218 # |
| 219 # Create and populate lib/{core, crypto, isolate, json, uri, utf, ...}. | 219 # Create and populate lib/{core, crypto, isolate, json, uri, utf, ...}. |
| 220 # | 220 # |
| 221 | 221 |
| 222 for library in ['_internal', 'compiler', 'html', 'core', 'coreimpl', | 222 for library in ['_internal', 'compiler', 'html', 'core', 'coreimpl', |
| 223 'crypto', 'isolate', 'json', 'math', 'mirrors', 'uri', 'utf', | 223 'crypto', 'isolate', 'json', 'math', 'mirrors', 'uri', 'utf']: |
| 224 'web']: | |
| 225 copytree(join(HOME, 'lib', library), join(LIB, library), | 224 copytree(join(HOME, 'lib', library), join(LIB, library), |
| 226 ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh')) | 225 ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh')) |
| 227 | 226 |
| 228 # TODO(dgrove): fix this really ugly hack | 227 # TODO(dgrove): fix this really ugly hack |
| 229 ReplaceInFiles( | 228 ReplaceInFiles( |
| 230 [join(LIB, 'compiler', 'implementation', 'lib', 'io.dart')], | 229 [join(LIB, 'compiler', 'implementation', 'lib', 'io.dart')], |
| 231 [('../../runtime/bin', '../io/runtime')]) | 230 [('../../runtime/bin', '../io/runtime')]) |
| 232 | 231 |
| 233 # Create and copy pkg. | 232 # Create and copy pkg. |
| 234 PKG = join(SDK_tmp, 'pkg') | 233 PKG = join(SDK_tmp, 'pkg') |
| 235 os.makedirs(PKG) | 234 os.makedirs(PKG) |
| 236 | 235 |
| 237 # | 236 # |
| 238 # Create and populate pkg/{args, intl, logging, unittest} | 237 # Create and populate pkg/{args, intl, logging, unittest} |
| 239 # | 238 # |
| 240 | 239 |
| 241 for library in ['args', 'dartdoc', 'intl', 'logging', 'unittest']: | 240 for library in ['args', 'htmlescape', dartdoc', 'intl', 'logging', 'unittest']
: |
| 242 copytree(join(HOME, 'pkg', library), join(PKG, library), | 241 copytree(join(HOME, 'pkg', library), join(PKG, library), |
| 243 ignore=ignore_patterns('*.svn', 'doc', 'docs', | 242 ignore=ignore_patterns('*.svn', 'doc', 'docs', |
| 244 '*.py', '*.gypi', '*.sh')) | 243 '*.py', '*.gypi', '*.sh')) |
| 245 | 244 |
| 246 # Fixup dartdoc | 245 # Fixup dartdoc |
| 247 ReplaceInFiles([ | 246 ReplaceInFiles([ |
| 248 join(PKG, 'dartdoc', 'dartdoc.dart'), | 247 join(PKG, 'dartdoc', 'dartdoc.dart'), |
| 249 ], [ | 248 ], [ |
| 250 ("final bool IN_SDK = false;", | 249 ("final bool IN_SDK = false;", |
| 251 "final bool IN_SDK = true;"), | 250 "final bool IN_SDK = true;"), |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 if revision is not None: | 288 if revision is not None: |
| 290 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: | 289 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: |
| 291 f.write(revision + '\n') | 290 f.write(revision + '\n') |
| 292 f.close() | 291 f.close() |
| 293 | 292 |
| 294 move(SDK_tmp, SDK) | 293 move(SDK_tmp, SDK) |
| 295 utils.Touch(os.path.join(SDK, 'create.stamp')) | 294 utils.Touch(os.path.join(SDK, 'create.stamp')) |
| 296 | 295 |
| 297 if __name__ == '__main__': | 296 if __name__ == '__main__': |
| 298 sys.exit(Main(sys.argv)) | 297 sys.exit(Main(sys.argv)) |
| OLD | NEW |