| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 """Used to merge and copy dart source files for deployment to AppEngine""" | 5 """Used to merge and copy dart source files for deployment to AppEngine""" |
| 6 | 6 |
| 7 import fileinput | 7 import fileinput |
| 8 import sys | 8 import sys |
| 9 import shutil | 9 import shutil |
| 10 import os | 10 import os |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 lib = worklist.pop() | 99 lib = worklist.pop() |
| 100 if lib in seen: | 100 if lib in seen: |
| 101 continue | 101 continue |
| 102 | 102 |
| 103 seen.add(lib) | 103 seen.add(lib) |
| 104 | 104 |
| 105 if (dirname(dirname(lib)).endswith('dom/generated/src') | 105 if (dirname(dirname(lib)).endswith('dom/generated/src') |
| 106 or dirname(lib).endswith('dom/src')): | 106 or dirname(lib).endswith('dom/src')): |
| 107 continue | 107 continue |
| 108 | 108 |
| 109 if lib.endswith('json/json.dart'): | |
| 110 # TODO(jmesserly): Dartium interprets "json.dart" as "dart_json.dart", | |
| 111 # so we need that add dart_json.dart here. This is hacky. | |
| 112 lib = lib.replace('json.dart', 'dart_json.dart') | |
| 113 | |
| 114 library = parseLibrary(lib) | 109 library = parseLibrary(lib) |
| 115 | 110 |
| 116 # Ensure output directory exists | 111 # Ensure output directory exists |
| 117 outpath = join(outdir, lib[1:] if isabs(lib) else lib) | 112 outpath = join(outdir, lib[1:] if isabs(lib) else lib) |
| 118 dstpath = dirname(outpath) | 113 dstpath = dirname(outpath) |
| 119 if not exists(dstpath): | 114 if not exists(dstpath): |
| 120 os.makedirs(dstpath) | 115 os.makedirs(dstpath) |
| 121 | 116 |
| 122 | 117 |
| 123 # Create file containing all imports, and inlining all sources | 118 # Create file containing all imports, and inlining all sources |
| (...skipping 12 matching lines...) Expand all Loading... |
| 136 for suffix in library.imports: | 131 for suffix in library.imports: |
| 137 m = re.match(r'[\'"]([^\'"]+)[\'"](\s+as\s+\w+)?.*$', suffix) | 132 m = re.match(r'[\'"]([^\'"]+)[\'"](\s+as\s+\w+)?.*$', suffix) |
| 138 uri = m.group(1) | 133 uri = m.group(1) |
| 139 if not uri.startswith('dart:'): | 134 if not uri.startswith('dart:'): |
| 140 worklist.append(normjoin(dirname(lib), uri)); | 135 worklist.append(normjoin(dirname(lib), uri)); |
| 141 | 136 |
| 142 return 0 | 137 return 0 |
| 143 | 138 |
| 144 if __name__ == '__main__': | 139 if __name__ == '__main__': |
| 145 sys.exit(main(*sys.argv[1:])) | 140 sys.exit(main(*sys.argv[1:])) |
| OLD | NEW |