| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 var builtinLibraryOut = path.join(sdkOut, vmLibrary, '${vmLibrary}.dart'); | 201 var builtinLibraryOut = path.join(sdkOut, vmLibrary, '${vmLibrary}.dart'); |
| 202 _writeSync(builtinLibraryOut, readInputFile(builtinLibraryIn)); | 202 _writeSync(builtinLibraryOut, readInputFile(builtinLibraryIn)); |
| 203 } | 203 } |
| 204 | 204 |
| 205 for (var file in ['loader.dart', 'server.dart', 'vmservice_io.dart']) { | 205 for (var file in ['loader.dart', 'server.dart', 'vmservice_io.dart']) { |
| 206 var libraryIn = path.join(dartDir, 'runtime', 'bin', 'vmservice', file); | 206 var libraryIn = path.join(dartDir, 'runtime', 'bin', 'vmservice', file); |
| 207 var libraryOut = path.join(sdkOut, 'vmservice_io', file); | 207 var libraryOut = path.join(sdkOut, 'vmservice_io', file); |
| 208 _writeSync(libraryOut, readInputFile(libraryIn)); | 208 _writeSync(libraryOut, readInputFile(libraryIn)); |
| 209 } | 209 } |
| 210 | 210 |
| 211 final platform = path.join(outDir, 'platform.dill'); |
| 212 |
| 213 await compile_platform.mainEntryPoint(<String>[ |
| 214 '--packages', |
| 215 new Uri.file(packagesFile).toString(), |
| 216 new Uri.directory(outDir).toString(), |
| 217 platform, |
| 218 ]); |
| 219 |
| 211 // TODO(kustermann): We suppress compiler hints/warnings/errors temporarily | 220 // TODO(kustermann): We suppress compiler hints/warnings/errors temporarily |
| 212 // because everyone building the `runtime` target will get these now. | 221 // because everyone building the `runtime` target will get these now. |
| 213 // We should remove the suppression again once the underlying issues have | 222 // We should remove the suppression again once the underlying issues have |
| 214 // been fixed (either in fasta or the dart files in the patched_sdk). | 223 // been fixed (either in fasta or the dart files in the patched_sdk). |
| 215 final capturedLines = <String>[]; | 224 final capturedLines = <String>[]; |
| 216 try { | 225 try { |
| 217 final platform = path.join(outDir, 'platform.dill'); | |
| 218 | |
| 219 await runZoned(() async { | 226 await runZoned(() async { |
| 220 await compile_platform.mainEntryPoint(<String>[ | |
| 221 '--packages', | |
| 222 new Uri.file(packagesFile).toString(), | |
| 223 new Uri.directory(outDir).toString(), | |
| 224 platform, | |
| 225 ]); | |
| 226 | |
| 227 // platform.dill was generated, now generate platform.dill.d depfile | 227 // platform.dill was generated, now generate platform.dill.d depfile |
| 228 // that captures all dependencies that participated in the generation. | 228 // that captures all dependencies that participated in the generation. |
| 229 // There are two types of dependencies: | 229 // There are two types of dependencies: |
| 230 // (1) all Dart sources that constitute this tool itself | 230 // (1) all Dart sources that constitute this tool itself |
| 231 // (2) Dart SDK and patch sources. | 231 // (2) Dart SDK and patch sources. |
| 232 // We already collected all inputs from the second category in the deps | 232 // We already collected all inputs from the second category in the deps |
| 233 // set. To collect inputs from the first category we actually use Fasta: | 233 // set. To collect inputs from the first category we actually use Fasta: |
| 234 // we ask Fasta to outline patch_sdk.dart and generate a depfile which | 234 // we ask Fasta to outline patch_sdk.dart and generate a depfile which |
| 235 // would list all the sources. | 235 // would list all the sources. |
| 236 final depfile = "${outDir}.d"; | 236 final depfile = "${outDir}.d"; |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 if (diff != 0) return diff; | 606 if (diff != 0) return diff; |
| 607 return end - other.end; | 607 return end - other.end; |
| 608 } | 608 } |
| 609 } | 609 } |
| 610 | 610 |
| 611 List<SdkLibrary> _getSdkLibraries(String contents) { | 611 List<SdkLibrary> _getSdkLibraries(String contents) { |
| 612 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(true); | 612 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(true); |
| 613 parseCompilationUnit(contents).accept(libraryBuilder); | 613 parseCompilationUnit(contents).accept(libraryBuilder); |
| 614 return libraryBuilder.librariesMap.sdkLibraries; | 614 return libraryBuilder.librariesMap.sdkLibraries; |
| 615 } | 615 } |
| OLD | NEW |