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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 }, | 157 }, |
158 } | 158 } |
159 } | 159 } |
160 }); | 160 }); |
161 Uri vmserviceJsonUri = outDirUri.resolve("lib/vmservice_libraries.json"); | 161 Uri vmserviceJsonUri = outDirUri.resolve("lib/vmservice_libraries.json"); |
162 await _writeSync(vmserviceJsonUri.toFilePath(), vmserviceJson); | 162 await _writeSync(vmserviceJsonUri.toFilePath(), vmserviceJson); |
163 var program = await kernelForProgram( | 163 var program = await kernelForProgram( |
164 Uri.parse('dart:$vmserviceName'), | 164 Uri.parse('dart:$vmserviceName'), |
165 new CompilerOptions() | 165 new CompilerOptions() |
166 ..setExitCodeOnProblem = true | 166 ..setExitCodeOnProblem = true |
167 // TODO(sigmund): investigate. This should be outline, but it breaks | 167 ..sdkSummary = outline |
168 // vm-debug tests. Issue #30111 | |
169 ..sdkSummary = platform | |
170 ..librariesSpecificationUri = vmserviceJsonUri | 168 ..librariesSpecificationUri = vmserviceJsonUri |
171 ..packagesFileUri = packages); | 169 ..packagesFileUri = packages); |
172 Uri vmserviceUri = outDirUri.resolve('$vmserviceName.dill'); | 170 Uri vmserviceUri = outDirUri.resolve('$vmserviceName.dill'); |
173 // TODO(sigmund): remove. This is a workaround because in the VM | |
174 // doesn't support loading vmservice if it contains external libraries | |
175 // (there is an assertion that only fails in debug builds). Issue #30111 | |
176 program.libraries.forEach((l) => l.isExternal = false); | |
177 await writeProgramToFile(program, vmserviceUri); | 171 await writeProgramToFile(program, vmserviceUri); |
178 } | 172 } |
179 | 173 |
180 Uri platformFinalLocation = outDirUri.resolve('platform.dill'); | 174 Uri platformFinalLocation = outDirUri.resolve('platform.dill'); |
181 | 175 |
182 // We generate a dependency file for GN to properly regenerate the patched sdk | 176 // We generate a dependency file for GN to properly regenerate the patched sdk |
183 // folder, outline.dill and platform.dill files when necessary: either when | 177 // folder, outline.dill and platform.dill files when necessary: either when |
184 // the sdk sources change or when this script is updated. In particular: | 178 // the sdk sources change or when this script is updated. In particular: |
185 // | 179 // |
186 // - sdk changes: we track the actual sources we are compiling. If we are | 180 // - sdk changes: we track the actual sources we are compiling. If we are |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(forDart2js); | 815 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(forDart2js); |
822 parseCompilationUnit(contents).accept(libraryBuilder); | 816 parseCompilationUnit(contents).accept(libraryBuilder); |
823 return libraryBuilder.librariesMap.sdkLibraries; | 817 return libraryBuilder.librariesMap.sdkLibraries; |
824 } | 818 } |
825 | 819 |
826 void addLocation(Map<String, Map<String, String>> locations, String libraryName, | 820 void addLocation(Map<String, Map<String, String>> locations, String libraryName, |
827 String libraryPath) { | 821 String libraryPath) { |
828 assert(locations[libraryName] == null); | 822 assert(locations[libraryName] == null); |
829 locations[libraryName] = {'uri': '${path.toUri(libraryPath)}'}; | 823 locations[libraryName] = {'uri': '${path.toUri(libraryPath)}'}; |
830 } | 824 } |
OLD | NEW |