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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 if (forVm) { | 137 if (forVm) { |
138 // TODO(sigmund): add support for the flutter vmservice_sky as well. | 138 // TODO(sigmund): add support for the flutter vmservice_sky as well. |
139 var vmserviceName = 'vmservice_io'; | 139 var vmserviceName = 'vmservice_io'; |
140 var base = path.fromUri(Platform.script); | 140 var base = path.fromUri(Platform.script); |
141 Uri dartDir = | 141 Uri dartDir = |
142 new Uri.directory(path.dirname(path.dirname(path.absolute(base)))); | 142 new Uri.directory(path.dirname(path.dirname(path.absolute(base)))); |
143 var program = await kernelForProgram( | 143 var program = await kernelForProgram( |
144 Uri.parse('dart:$vmserviceName'), | 144 Uri.parse('dart:$vmserviceName'), |
145 new CompilerOptions() | 145 new CompilerOptions() |
| 146 ..setExitCodeOnProblem = true |
146 // TODO(sigmund): investigate. This should be outline, but it breaks | 147 // TODO(sigmund): investigate. This should be outline, but it breaks |
147 // vm-debug tests. Issue #30111 | 148 // vm-debug tests. Issue #30111 |
148 ..sdkSummary = platform | 149 ..sdkSummary = platform |
149 ..dartLibraries = <String, Uri>{ | 150 ..dartLibraries = <String, Uri>{ |
150 '_vmservice': dartDir.resolve('sdk/lib/vmservice/vmservice.dart'), | 151 '_vmservice': dartDir.resolve('sdk/lib/vmservice/vmservice.dart'), |
151 'vmservice_io': | 152 'vmservice_io': |
152 dartDir.resolve('runtime/bin/vmservice/vmservice_io.dart'), | 153 dartDir.resolve('runtime/bin/vmservice/vmservice_io.dart'), |
153 } | 154 } |
154 ..packagesFileUri = packages); | 155 ..packagesFileUri = packages); |
155 Uri vmserviceUri = outDirUri.resolve('$vmserviceName.dill'); | 156 Uri vmserviceUri = outDirUri.resolve('$vmserviceName.dill'); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 } | 198 } |
198 | 199 |
199 /// 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 |
200 /// compiling a platform's SDK. | 201 /// compiling a platform's SDK. |
201 /// | 202 /// |
202 /// 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 |
203 /// to create GN dependency files. | 204 /// to create GN dependency files. |
204 Future<List<Uri>> compilePlatform(Uri patchedSdk, Target target, Uri packages, | 205 Future<List<Uri>> compilePlatform(Uri patchedSdk, Target target, Uri packages, |
205 Uri fullOutput, Uri outlineOutput) async { | 206 Uri fullOutput, Uri outlineOutput) async { |
206 var options = new CompilerOptions() | 207 var options = new CompilerOptions() |
| 208 ..setExitCodeOnProblem = true |
207 ..strongMode = false | 209 ..strongMode = false |
208 ..compileSdk = true | 210 ..compileSdk = true |
209 ..sdkRoot = patchedSdk | 211 ..sdkRoot = patchedSdk |
210 ..packagesFileUri = packages | 212 ..packagesFileUri = packages |
211 ..chaseDependencies = true | 213 ..chaseDependencies = true |
212 ..target = target; | 214 ..target = target; |
213 | 215 |
214 var result = await generateKernel( | 216 var result = await generateKernel( |
215 new ProcessedOptions( | 217 new ProcessedOptions( |
216 options, | 218 options, |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 if (diff != 0) return diff; | 741 if (diff != 0) return diff; |
740 return end - other.end; | 742 return end - other.end; |
741 } | 743 } |
742 } | 744 } |
743 | 745 |
744 List<SdkLibrary> _getSdkLibraries(String contents) { | 746 List<SdkLibrary> _getSdkLibraries(String contents) { |
745 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(forDart2js); | 747 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(forDart2js); |
746 parseCompilationUnit(contents).accept(libraryBuilder); | 748 parseCompilationUnit(contents).accept(libraryBuilder); |
747 return libraryBuilder.librariesMap.sdkLibraries; | 749 return libraryBuilder.librariesMap.sdkLibraries; |
748 } | 750 } |
OLD | NEW |