| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2011, 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 # | 260 # |
| 261 | 261 |
| 262 # First, copy corelib/* to lib/{compiler, frog, runtime} | 262 # First, copy corelib/* to lib/{compiler, frog, runtime} |
| 263 for filename in corelib_sources: | 263 for filename in corelib_sources: |
| 264 for target_dir in ['compiler', 'frog', 'runtime']: | 264 for target_dir in ['compiler', 'frog', 'runtime']: |
| 265 copyfile(join('corelib', 'src', filename), | 265 copyfile(join('corelib', 'src', filename), |
| 266 join(corelib_dest_dir, target_dir, filename)) | 266 join(corelib_dest_dir, target_dir, filename)) |
| 267 | 267 |
| 268 # Next, copy the compiler sources on top of {core,coreimpl}/compiler | 268 # Next, copy the compiler sources on top of {core,coreimpl}/compiler |
| 269 for filename in corelib_compiler_sources: | 269 for filename in corelib_compiler_sources: |
| 270 if (filename.endswith(".dart")): | 270 if filename.endswith('.dart'): |
| 271 filename = re.sub("lib/","", filename) | 271 filename = re.sub('lib/','', filename) |
| 272 if not filename.startswith("implementation/"): | 272 if (not filename.startswith('implementation/') and |
| 273 not filename.startswith('corelib')): |
| 273 copyfile(join('compiler', 'lib', filename), | 274 copyfile(join('compiler', 'lib', filename), |
| 274 join(corelib_dest_dir, 'compiler', filename)) | 275 join(corelib_dest_dir, 'compiler', filename)) |
| 275 | 276 |
| 276 # Next, copy the frog library source on top of core/frog | 277 # Next, copy the frog library source on top of core/frog |
| 277 # TOOD(dgrove): move json to top-level | 278 # TOOD(dgrove): move json to top-level |
| 278 for filename in corelib_frog_sources: | 279 for filename in corelib_frog_sources: |
| 279 copyfile(join('frog', 'lib', filename), | 280 copyfile(join('frog', 'lib', filename), |
| 280 join(corelib_dest_dir, 'frog', filename)) | 281 join(corelib_dest_dir, 'frog', filename)) |
| 281 | 282 |
| 282 # Next, copy the runtime library source on top of core/runtime | 283 # Next, copy the runtime library source on top of core/runtime |
| (...skipping 18 matching lines...) Expand all Loading... |
| 301 dest_file = open(join(corelib_dest_dir, 'core_runtime.dart'), 'w') | 302 dest_file = open(join(corelib_dest_dir, 'core_runtime.dart'), 'w') |
| 302 dest_file.write('#library("dart:core");\n') | 303 dest_file.write('#library("dart:core");\n') |
| 303 dest_file.write('#import("dart:coreimpl");\n') | 304 dest_file.write('#import("dart:coreimpl");\n') |
| 304 for filename in corelib_sources: | 305 for filename in corelib_sources: |
| 305 dest_file.write('#source("runtime/' + filename + '");\n') | 306 dest_file.write('#source("runtime/' + filename + '");\n') |
| 306 for filename in corelib_runtime_sources: | 307 for filename in corelib_runtime_sources: |
| 307 if filename.endswith('.dart'): | 308 if filename.endswith('.dart'): |
| 308 dest_file.write('#source("runtime/' + filename + '");\n') | 309 dest_file.write('#source("runtime/' + filename + '");\n') |
| 309 dest_file.close() | 310 dest_file.close() |
| 310 | 311 |
| 311 # TODO(dgrove) - create lib/core/core_compiler.dart . | 312 # construct lib/core_compiler.dart from whole cloth. |
| 313 dest_file = open(join(corelib_dest_dir, 'core_compiler.dart'), 'w') |
| 314 dest_file.write('#library("dart:core");\n') |
| 315 dest_file.write('#import("dart:coreimpl");\n') |
| 316 for filename in os.listdir(join(corelib_dest_dir, 'compiler')): |
| 317 dest_file.write('#import("compiler/' + filename + '");\n') |
| 318 dest_file.close() |
| 312 | 319 |
| 313 # | 320 # |
| 314 # Create and populate lib/coreimpl. | 321 # Create and populate lib/coreimpl. |
| 315 # | 322 # |
| 316 | 323 |
| 317 # First, copy corelib/src/implementation to corelib/{compiler, frog, runtime}. | 324 # First, copy corelib/src/implementation to corelib/{compiler, frog, runtime}. |
| 318 for filename in coreimpl_sources: | 325 for filename in coreimpl_sources: |
| 319 for target_dir in ['compiler', 'frog', 'runtime']: | 326 for target_dir in ['compiler', 'frog', 'runtime']: |
| 320 copyfile(join('corelib', 'src', 'implementation', filename), | 327 copyfile(join('corelib', 'src', 'implementation', filename), |
| 321 join(coreimpl_dest_dir, target_dir, filename)) | 328 join(coreimpl_dest_dir, target_dir, filename)) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 351 # Construct lib/coreimpl/coreimpl_runtime.dart from whole cloth. | 358 # Construct lib/coreimpl/coreimpl_runtime.dart from whole cloth. |
| 352 dest_file = open(join(coreimpl_dest_dir, 'coreimpl_runtime.dart'), 'w') | 359 dest_file = open(join(coreimpl_dest_dir, 'coreimpl_runtime.dart'), 'w') |
| 353 dest_file.write('#library("dart:coreimpl");\n') | 360 dest_file.write('#library("dart:coreimpl");\n') |
| 354 for filename in coreimpl_sources: | 361 for filename in coreimpl_sources: |
| 355 dest_file.write('#source("runtime/' + filename + '");\n') | 362 dest_file.write('#source("runtime/' + filename + '");\n') |
| 356 for filename in coreimpl_runtime_sources: | 363 for filename in coreimpl_runtime_sources: |
| 357 if filename.endswith('.dart'): | 364 if filename.endswith('.dart'): |
| 358 dest_file.write('#source("runtime/' + filename + '");\n') | 365 dest_file.write('#source("runtime/' + filename + '");\n') |
| 359 dest_file.close() | 366 dest_file.close() |
| 360 | 367 |
| 361 # TODO(dgrove) - create lib/coreimpl/coreimpl_compiler.dart . | 368 # construct lib/coreimpl_compiler.dart from whole cloth. |
| 369 dest_file = open(join(coreimpl_dest_dir, 'coreimpl_compiler.dart'), 'w') |
| 370 dest_file.write('#library("dart:coreimpl");\n') |
| 371 for filename in os.listdir(join(coreimpl_dest_dir, 'compiler')): |
| 372 dest_file.write('#import("compiler/' + filename + '");\n') |
| 373 dest_file.close() |
| 362 | 374 |
| 363 # Create and copy tools. | 375 # Create and copy tools. |
| 364 | 376 |
| 365 UTIL = join(SDK_tmp, 'util') | 377 UTIL = join(SDK_tmp, 'util') |
| 366 os.makedirs(UTIL) | 378 os.makedirs(UTIL) |
| 367 | 379 |
| 368 copytree(join(HOME, 'utils', 'dartdoc'), join(UTIL, 'dartdoc'), | 380 copytree(join(HOME, 'utils', 'dartdoc'), join(UTIL, 'dartdoc'), |
| 369 ignore=ignore_patterns('.svn')) | 381 ignore=ignore_patterns('.svn')) |
| 370 | 382 |
| 371 copytree(SDK_tmp, SDK) | 383 copytree(SDK_tmp, SDK) |
| 372 rmtree(SDK_tmp) | 384 rmtree(SDK_tmp) |
| 373 | 385 |
| 374 if __name__ == '__main__': | 386 if __name__ == '__main__': |
| 375 sys.exit(Main(sys.argv)) | 387 sys.exit(Main(sys.argv)) |
| OLD | NEW |