| 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 ..sdkSummary = outline | 146 // TODO(sigmund): investigate. This should be outline, but it breaks |
| 147 // vm-debug tests. Issue #30111 |
| 148 ..sdkSummary = platform |
| 147 ..dartLibraries = <String, Uri>{ | 149 ..dartLibraries = <String, Uri>{ |
| 148 '_vmservice': dartDir.resolve('sdk/lib/vmservice/vmservice.dart'), | 150 '_vmservice': dartDir.resolve('sdk/lib/vmservice/vmservice.dart'), |
| 149 'vmservice_io': | 151 'vmservice_io': |
| 150 dartDir.resolve('runtime/bin/vmservice/vmservice_io.dart'), | 152 dartDir.resolve('runtime/bin/vmservice/vmservice_io.dart'), |
| 151 } | 153 } |
| 152 ..packagesFileUri = packages); | 154 ..packagesFileUri = packages); |
| 153 Uri vmserviceUri = outDirUri.resolve('$vmserviceName.dill'); | 155 Uri vmserviceUri = outDirUri.resolve('$vmserviceName.dill'); |
| 156 // TODO(sigmund): remove. This is a workaround because in the VM |
| 157 // doesn't support loading vmservice if it contains external libraries |
| 158 // (there is an assertion that only fails in debug builds). Issue #30111 |
| 159 program.libraries.forEach((l) => l.isExternal = false); |
| 154 await writeProgramToFile(program, vmserviceUri); | 160 await writeProgramToFile(program, vmserviceUri); |
| 155 } | 161 } |
| 156 | 162 |
| 157 Uri platformFinalLocation = outDirUri.resolve('platform.dill'); | 163 Uri platformFinalLocation = outDirUri.resolve('platform.dill'); |
| 158 | 164 |
| 159 // We generate a dependency file for GN to properly regenerate the patched sdk | 165 // We generate a dependency file for GN to properly regenerate the patched sdk |
| 160 // folder, outline.dill and platform.dill files when necessary: either when | 166 // folder, outline.dill and platform.dill files when necessary: either when |
| 161 // the sdk sources change or when this script is updated. In particular: | 167 // the sdk sources change or when this script is updated. In particular: |
| 162 // | 168 // |
| 163 // - sdk changes: we track the actual sources we are compiling. If we are | 169 // - sdk changes: we track the actual sources we are compiling. If we are |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 if (diff != 0) return diff; | 739 if (diff != 0) return diff; |
| 734 return end - other.end; | 740 return end - other.end; |
| 735 } | 741 } |
| 736 } | 742 } |
| 737 | 743 |
| 738 List<SdkLibrary> _getSdkLibraries(String contents) { | 744 List<SdkLibrary> _getSdkLibraries(String contents) { |
| 739 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(forDart2js); | 745 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(forDart2js); |
| 740 parseCompilationUnit(contents).accept(libraryBuilder); | 746 parseCompilationUnit(contents).accept(libraryBuilder); |
| 741 return libraryBuilder.librariesMap.sdkLibraries; | 747 return libraryBuilder.librariesMap.sdkLibraries; |
| 742 } | 748 } |
| OLD | NEW |