| OLD | NEW |
| 1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
| 2 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2015, 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 | 5 |
| 6 /// Command line tool to merge the SDK libraries and our patch files. | 6 /// Command line tool to merge the SDK libraries and our patch files. |
| 7 /// This is currently designed as an offline tool, but we could automate it. | 7 /// This is currently designed as an offline tool, but we could automate it. |
| 8 | 8 |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 import 'dart:async'; | 10 import 'dart:async'; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 print('For example:'); | 35 print('For example:'); |
| 36 print('\$ $self vm $sdkExample $patchExample $outExample'); | 36 print('\$ $self vm $sdkExample $patchExample $outExample'); |
| 37 | 37 |
| 38 exit(1); | 38 exit(1); |
| 39 } | 39 } |
| 40 | 40 |
| 41 var mode = argv[0]; | 41 var mode = argv[0]; |
| 42 var input = argv[1]; | 42 var input = argv[1]; |
| 43 var sdkLibIn = path.join(input, 'lib'); | 43 var sdkLibIn = path.join(input, 'lib'); |
| 44 var patchIn = argv[2]; | 44 var patchIn = argv[2]; |
| 45 var sdkOut = path.join(argv[3], 'lib'); | 45 var outDir = argv[3]; |
| 46 var sdkOut = path.join(outDir, 'lib'); |
| 46 var packagesFile = argv[4]; | 47 var packagesFile = argv[4]; |
| 47 | 48 |
| 48 var privateIn = path.join(input, 'private'); | 49 var privateIn = path.join(input, 'private'); |
| 49 var INTERNAL_PATH = '_internal/compiler/js_lib/'; | 50 var INTERNAL_PATH = '_internal/compiler/js_lib/'; |
| 50 | 51 |
| 51 // Copy and patch libraries.dart and version | 52 // Copy and patch libraries.dart and version |
| 52 var libContents = new File(path.join(sdkLibIn, '_internal', | 53 var libContents = new File(path.join(sdkLibIn, '_internal', |
| 53 'sdk_library_metadata', 'lib', 'libraries.dart')).readAsStringSync(); | 54 'sdk_library_metadata', 'lib', 'libraries.dart')).readAsStringSync(); |
| 54 var patchedLibContents = libContents; | 55 var patchedLibContents = libContents; |
| 55 if (mode == 'vm') { | 56 if (mode == 'vm') { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // TODO(kustermann): We suppress compiler hints/warnings/errors temporarily | 199 // TODO(kustermann): We suppress compiler hints/warnings/errors temporarily |
| 199 // because everyone building the `runtime` target will get these now. | 200 // because everyone building the `runtime` target will get these now. |
| 200 // We should remove the suppression again once the underlying issues have | 201 // We should remove the suppression again once the underlying issues have |
| 201 // been fixed (either in fasta or the dart files in the patched_sdk). | 202 // been fixed (either in fasta or the dart files in the patched_sdk). |
| 202 final capturedLines = <String>[]; | 203 final capturedLines = <String>[]; |
| 203 try { | 204 try { |
| 204 await runZoned(() async { | 205 await runZoned(() async { |
| 205 await compile_platform.main(<String>[ | 206 await compile_platform.main(<String>[ |
| 206 '--packages', | 207 '--packages', |
| 207 new Uri.file(packagesFile).toString(), | 208 new Uri.file(packagesFile).toString(), |
| 208 sdkOut, | 209 outDir, |
| 209 path.join(sdkOut, 'platform.dill') | 210 path.join(outDir, 'platform.dill') |
| 210 ]); | 211 ]); |
| 211 }, zoneSpecification: new ZoneSpecification(print: (_, _2, _3, line) { | 212 }, zoneSpecification: new ZoneSpecification(print: (_, _2, _3, line) { |
| 212 capturedLines.add(line); | 213 capturedLines.add(line); |
| 213 })); | 214 })); |
| 214 } catch (_) { | 215 } catch (_) { |
| 215 for (final line in capturedLines) { | 216 for (final line in capturedLines) { |
| 216 print(line); | 217 print(line); |
| 217 } | 218 } |
| 218 rethrow; | 219 rethrow; |
| 219 } | 220 } |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 if (diff != 0) return diff; | 554 if (diff != 0) return diff; |
| 554 return end - other.end; | 555 return end - other.end; |
| 555 } | 556 } |
| 556 } | 557 } |
| 557 | 558 |
| 558 List<SdkLibrary> _getSdkLibraries(String contents) { | 559 List<SdkLibrary> _getSdkLibraries(String contents) { |
| 559 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(true); | 560 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(true); |
| 560 parseCompilationUnit(contents).accept(libraryBuilder); | 561 parseCompilationUnit(contents).accept(libraryBuilder); |
| 561 return libraryBuilder.librariesMap.sdkLibraries; | 562 return libraryBuilder.librariesMap.sdkLibraries; |
| 562 } | 563 } |
| OLD | NEW |