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:isolate' show RawReceivePort; | 10 import 'dart:isolate' show RawReceivePort; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 var sdkDir = outDirUri; | 185 var sdkDir = outDirUri; |
186 if (forDart2js || forFlutter) { | 186 if (forDart2js || forFlutter) { |
187 // Note: this would fail if `../patched_sdk/platform.dill` doesn't exist. We | 187 // Note: this would fail if `../patched_sdk/platform.dill` doesn't exist. We |
188 // added an explicit dependency in the .GN rules so patched_dart2js_sdk (and | 188 // added an explicit dependency in the .GN rules so patched_dart2js_sdk (and |
189 // patched_flutter_sdk) depend on patched_sdk to ensure that it exists. | 189 // patched_flutter_sdk) depend on patched_sdk to ensure that it exists. |
190 platformForDeps = outDirUri.resolve('../patched_sdk/platform.dill'); | 190 platformForDeps = outDirUri.resolve('../patched_sdk/platform.dill'); |
191 sdkDir = outDirUri.resolve('../patched_sdk/'); | 191 sdkDir = outDirUri.resolve('../patched_sdk/'); |
192 } | 192 } |
193 deps.addAll(await fasta.getDependencies(Platform.script, | 193 deps.addAll(await fasta.getDependencies(Platform.script, |
194 sdk: sdkDir, packages: packages, platform: platformForDeps)); | 194 sdk: sdkDir, packages: packages, platform: platformForDeps)); |
195 await writeDepsFile(Uri.base.resolveUri(new Uri.file("$outDir.d")), | 195 await writeDepsFile(platformFinalLocation, |
196 platformFinalLocation, deps); | 196 Uri.base.resolveUri(new Uri.file("$outDir.d")), deps); |
197 await new File.fromUri(platform).rename(platformFinalLocation.toFilePath()); | 197 await new File.fromUri(platform).rename(platformFinalLocation.toFilePath()); |
198 } | 198 } |
199 | 199 |
200 /// Generates an outline.dill and platform.dill file containing the result of | 200 /// Generates an outline.dill and platform.dill file containing the result of |
201 /// compiling a platform's SDK. | 201 /// compiling a platform's SDK. |
202 /// | 202 /// |
203 /// Returns a list of dependencies read by the compiler. This list can be used | 203 /// Returns a list of dependencies read by the compiler. This list can be used |
204 /// to create GN dependency files. | 204 /// to create GN dependency files. |
205 Future<List<Uri>> compilePlatform(Uri patchedSdk, Target target, Uri packages, | 205 Future<List<Uri>> compilePlatform(Uri patchedSdk, Target target, Uri packages, |
206 Uri fullOutput, Uri outlineOutput) async { | 206 Uri fullOutput, Uri outlineOutput) async { |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 if (diff != 0) return diff; | 741 if (diff != 0) return diff; |
742 return end - other.end; | 742 return end - other.end; |
743 } | 743 } |
744 } | 744 } |
745 | 745 |
746 List<SdkLibrary> _getSdkLibraries(String contents) { | 746 List<SdkLibrary> _getSdkLibraries(String contents) { |
747 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(forDart2js); | 747 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(forDart2js); |
748 parseCompilationUnit(contents).accept(libraryBuilder); | 748 parseCompilationUnit(contents).accept(libraryBuilder); |
749 return libraryBuilder.librariesMap.sdkLibraries; | 749 return libraryBuilder.librariesMap.sdkLibraries; |
750 } | 750 } |
OLD | NEW |