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 if utils.GuessOS() == 'win32': | 96 if utils.GuessOS() == 'win32': |
97 file_extension = '.bat' | 97 file_extension = '.bat' |
98 | 98 |
99 src = src_file + file_extension | 99 src = src_file + file_extension |
100 dest = join(dest_dir, basename(src_file) + file_extension) | 100 dest = join(dest_dir, basename(src_file) + file_extension) |
101 Copy(src, dest) | 101 Copy(src, dest) |
102 | 102 |
103 | 103 |
104 def CopyDart2Js(build_dir, sdk_root, revision): | 104 def CopyDart2Js(build_dir, sdk_root, revision): |
105 if revision: | 105 if revision: |
106 ReplaceInFiles([os.path.join(sdk_root, 'pkg', 'compiler', | 106 ReplaceInFiles([os.path.join(sdk_root, 'pkg', 'compiler', |
107 'implementation', 'compiler.dart')], | 107 'implementation', 'compiler.dart')], |
108 [(r"BUILD_ID = 'build number could not be determined'", | 108 [(r"BUILD_ID = 'build number could not be determined'", |
109 r"BUILD_ID = '%s'" % revision)]) | 109 r"BUILD_ID = '%s'" % revision)]) |
110 if utils.GuessOS() == 'win32': | 110 if utils.GuessOS() == 'win32': |
111 dart2js = os.path.join(sdk_root, 'bin', 'dart2js.bat') | 111 dart2js = os.path.join(sdk_root, 'bin', 'dart2js.bat') |
112 Copy(os.path.join(build_dir, 'dart2js.bat'), dart2js) | 112 Copy(os.path.join(build_dir, 'dart2js.bat'), dart2js) |
113 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc.bat') | 113 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc.bat') |
114 Copy(os.path.join(build_dir, 'dartdoc.bat'), dartdoc) | 114 Copy(os.path.join(build_dir, 'dartdoc.bat'), dartdoc) |
115 # TODO(dgrove) - fix this once issue 4788 is addressed. | 115 # TODO(dgrove) - fix this once issue 4788 is addressed. |
116 ReplaceInFiles([dart2js], | 116 ReplaceInFiles([dart2js], |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 230 |
231 | 231 |
232 # Create and copy pkg. | 232 # Create and copy pkg. |
233 PKG = join(SDK_tmp, 'pkg') | 233 PKG = join(SDK_tmp, 'pkg') |
234 os.makedirs(PKG) | 234 os.makedirs(PKG) |
235 | 235 |
236 # | 236 # |
237 # Create and populate pkg/{args, intl, logging, meta, unittest} | 237 # Create and populate pkg/{args, intl, logging, meta, unittest} |
238 # | 238 # |
239 | 239 |
240 for library in ['args', 'htmlescape', 'dartdoc', 'intl', 'logging', | 240 for library in ['args', 'htmlescape', 'dartdoc', 'intl', 'logging', |
241 'meta', 'unittest']: | 241 'meta', 'unittest']: |
242 copytree(join(HOME, 'pkg', library), join(PKG, library), | 242 copytree(join(HOME, 'pkg', library), join(PKG, library), |
243 ignore=ignore_patterns('*.svn', 'doc', 'docs', | 243 ignore=ignore_patterns('*.svn', 'doc', 'docs', |
244 '*.py', '*.gypi', '*.sh')) | 244 '*.py', '*.gypi', '*.sh')) |
245 | 245 |
246 # TODO(dgrove): Remove this once issue 4788 is addressed. | 246 # TODO(dgrove): Remove this once issue 4788 is addressed. |
247 copytree(join(HOME, 'lib', 'compiler'), join(PKG, 'compiler'), | 247 copytree(join(HOME, 'lib', 'compiler'), join(PKG, 'compiler'), |
248 ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh')) | 248 ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh')) |
249 | 249 |
250 ReplaceInFiles( | 250 ReplaceInFiles( |
251 [join(LIB, '_internal', 'libraries.dart')], | 251 [join(LIB, '_internal', 'libraries.dart')], |
252 [('"compiler/', '"../pkg/compiler/')]) | 252 [('"compiler/', '"../pkg/compiler/')]) |
253 | 253 |
254 ReplaceInFiles( | 254 ReplaceInFiles( |
255 [join(PKG, 'compiler', 'implementation', 'lib', 'io.dart')], | 255 [join(PKG, 'compiler', 'implementation', 'lib', 'io.dart')], |
256 [('../../runtime/bin', '../../lib/io/runtime')]) | 256 [('../../runtime/bin', '../../lib/io/runtime')]) |
257 | 257 |
258 # Fixup dartdoc | 258 # Fixup dartdoc |
259 ReplaceInFiles([ | 259 ReplaceInFiles([ |
260 join(PKG, 'dartdoc', 'dartdoc.dart'), | 260 join(PKG, 'dartdoc', 'bin', 'dartdoc.dart'), |
261 ], [ | 261 ], [ |
262 ("final bool IN_SDK = false;", | 262 ("final bool _IN_SDK = false;", |
263 "final bool IN_SDK = true;"), | 263 "final bool _IN_SDK = true;"), |
264 ]) | 264 ]) |
265 | 265 |
266 # TODO(dgrove): Remove this once issue 4788 is addressed. | 266 # TODO(dgrove): Remove this once issue 4788 is addressed. |
267 ReplaceInFiles([ | 267 ReplaceInFiles([ |
268 join(PKG, 'dartdoc', 'mirrors', 'dart2js_mirror.dart'), | 268 join(PKG, 'dartdoc', 'lib', 'src', 'mirrors', 'dart2js_mirror.dart'), |
269 join(PKG, 'dartdoc', 'mirrors', 'mirrors_util.dart'), | 269 join(PKG, 'dartdoc', 'lib', 'mirrors_util.dart'), |
270 join(PKG, 'dartdoc', 'classify.dart'), | 270 join(PKG, 'dartdoc', 'lib', 'classify.dart'), |
271 join(PKG, 'dartdoc', 'client-live-nav.dart'), | 271 join(PKG, 'dartdoc', 'lib', 'src', 'client', 'client-live-nav.dart'), |
272 join(PKG, 'dartdoc', 'client-static.dart'), | 272 join(PKG, 'dartdoc', 'lib', 'src', 'client', 'client-static.dart'), |
273 join(PKG, 'dartdoc', 'dartdoc.dart'), | 273 join(PKG, 'dartdoc', 'lib', 'dartdoc.dart'), |
274 ], [ | 274 ], [ |
275 ("../../lib/compiler", | 275 ("../../lib/compiler", |
276 "../../pkg/compiler"), | 276 "../../pkg/compiler"), |
277 ]) | 277 ]) |
278 | 278 |
279 # Create and copy tools. | 279 # Create and copy tools. |
280 UTIL = join(SDK_tmp, 'util') | 280 UTIL = join(SDK_tmp, 'util') |
281 os.makedirs(UTIL) | 281 os.makedirs(UTIL) |
282 | 282 |
283 if ShouldCopyAnalyzer(): | 283 if ShouldCopyAnalyzer(): |
(...skipping 29 matching lines...) Expand all Loading... |
313 if revision is not None: | 313 if revision is not None: |
314 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: | 314 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: |
315 f.write(revision + '\n') | 315 f.write(revision + '\n') |
316 f.close() | 316 f.close() |
317 | 317 |
318 move(SDK_tmp, SDK) | 318 move(SDK_tmp, SDK) |
319 utils.Touch(os.path.join(SDK, 'create.stamp')) | 319 utils.Touch(os.path.join(SDK, 'create.stamp')) |
320 | 320 |
321 if __name__ == '__main__': | 321 if __name__ == '__main__': |
322 sys.exit(Main(sys.argv)) | 322 sys.exit(Main(sys.argv)) |
OLD | NEW |