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 ..sdkSummary = outline | 167 // TODO(sigmund): investigate. This should be outline, but it breaks |
| 168 // vm-debug tests. Issue #30111 |
| 169 ..sdkSummary = platform |
168 ..librariesSpecificationUri = vmserviceJsonUri | 170 ..librariesSpecificationUri = vmserviceJsonUri |
169 ..packagesFileUri = packages); | 171 ..packagesFileUri = packages); |
170 Uri vmserviceUri = outDirUri.resolve('$vmserviceName.dill'); | 172 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); |
171 await writeProgramToFile(program, vmserviceUri); | 177 await writeProgramToFile(program, vmserviceUri); |
172 } | 178 } |
173 | 179 |
174 Uri platformFinalLocation = outDirUri.resolve('platform.dill'); | 180 Uri platformFinalLocation = outDirUri.resolve('platform.dill'); |
175 | 181 |
176 // We generate a dependency file for GN to properly regenerate the patched sdk | 182 // We generate a dependency file for GN to properly regenerate the patched sdk |
177 // folder, outline.dill and platform.dill files when necessary: either when | 183 // folder, outline.dill and platform.dill files when necessary: either when |
178 // the sdk sources change or when this script is updated. In particular: | 184 // the sdk sources change or when this script is updated. In particular: |
179 // | 185 // |
180 // - sdk changes: we track the actual sources we are compiling. If we are | 186 // - 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... |
815 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(forDart2js); | 821 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(forDart2js); |
816 parseCompilationUnit(contents).accept(libraryBuilder); | 822 parseCompilationUnit(contents).accept(libraryBuilder); |
817 return libraryBuilder.librariesMap.sdkLibraries; | 823 return libraryBuilder.librariesMap.sdkLibraries; |
818 } | 824 } |
819 | 825 |
820 void addLocation(Map<String, Map<String, String>> locations, String libraryName, | 826 void addLocation(Map<String, Map<String, String>> locations, String libraryName, |
821 String libraryPath) { | 827 String libraryPath) { |
822 assert(locations[libraryName] == null); | 828 assert(locations[libraryName] == null); |
823 locations[libraryName] = {'uri': '${path.toUri(libraryPath)}'}; | 829 locations[libraryName] = {'uri': '${path.toUri(libraryPath)}'}; |
824 } | 830 } |
OLD | NEW |