| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2014, 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 # Create the compiler_unsupported package. This will copy the | 7 # Create the compiler_unsupported package. This will copy the |
| 8 # sdk/lib/_internal/compiler directory and the libraries.dart file into lib/. | 8 # sdk/lib/_internal/compiler directory and the libraries.dart file into lib/. |
| 9 # | 9 # |
| 10 # Usage: create_library.py | 10 # Usage: create_library.py |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 def Main(argv): | 37 def Main(argv): |
| 38 # pkg/compiler_unsupported | 38 # pkg/compiler_unsupported |
| 39 HOME = dirname(dirname(os.path.realpath(__file__))) | 39 HOME = dirname(dirname(os.path.realpath(__file__))) |
| 40 | 40 |
| 41 # pkg/compiler_unsupported/lib | 41 # pkg/compiler_unsupported/lib |
| 42 TARGET = join(HOME, 'lib') | 42 TARGET = join(HOME, 'lib') |
| 43 | 43 |
| 44 # sdk/lib/_internal | 44 # sdk/lib/_internal |
| 45 SOURCE = join(dirname(dirname(HOME)), 'sdk', 'lib', '_internal') | 45 SOURCE = join(dirname(dirname(HOME)), 'sdk', 'lib', '_internal') |
| 46 | 46 |
| 47 # pkg | |
| 48 PKG_SOURCE = join(dirname(dirname(HOME)), 'pkg') | |
| 49 | |
| 50 # clean compiler_unsupported/lib | 47 # clean compiler_unsupported/lib |
| 51 if not os.path.exists(TARGET): | 48 if not os.path.exists(TARGET): |
| 52 os.mkdir(TARGET) | 49 os.mkdir(TARGET) |
| 53 shutil.rmtree(join(TARGET, 'src'), True) | 50 shutil.rmtree(join(TARGET, 'implementation'), True) |
| 54 RemoveFile(join(TARGET, 'compiler.dart')) | 51 RemoveFile(join(TARGET, 'compiler.dart')) |
| 55 RemoveFile(join(TARGET, 'libraries.dart')) | 52 RemoveFile(join(TARGET, 'libraries.dart')) |
| 56 | 53 |
| 57 # copy dart2js code | 54 # copy dart2js code |
| 58 shutil.copy(join(PKG_SOURCE, 'compiler', 'lib', 'compiler.dart'), TARGET) | 55 shutil.copy(join(SOURCE, 'compiler', 'compiler.dart'), TARGET) |
| 59 shutil.copy(join(SOURCE, 'libraries.dart'), TARGET) | 56 shutil.copy(join(SOURCE, 'libraries.dart'), TARGET) |
| 60 shutil.copytree( | 57 shutil.copytree( |
| 61 join(PKG_SOURCE, 'compiler', 'lib', 'src'), | 58 join(SOURCE, 'compiler', 'implementation'), |
| 62 join(TARGET, 'src')) | 59 join(TARGET, 'implementation')) |
| 63 | 60 |
| 64 # patch up the libraries.dart references | 61 # patch up the libraries.dart references |
| 65 replace = [(r'\.\./\.\./libraries\.dart', r'\.\./libraries\.dart')] | 62 replace = [(r'\.\./\.\./libraries\.dart', r'\.\./libraries\.dart')] |
| 66 | 63 |
| 67 for root, dirs, files in os.walk(join(TARGET, 'src')): | 64 for root, dirs, files in os.walk(join(TARGET, 'implementation')): |
| 68 for name in files: | 65 for name in files: |
| 69 if name.endswith('.dart'): | 66 if name.endswith('.dart'): |
| 70 ReplaceInFiles([join(root, name)], replace) | 67 ReplaceInFiles([join(root, name)], replace) |
| 71 | 68 |
| 72 | 69 |
| 73 if __name__ == '__main__': | 70 if __name__ == '__main__': |
| 74 sys.exit(Main(sys.argv)) | 71 sys.exit(Main(sys.argv)) |
| OLD | NEW |