Chromium Code Reviews| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 Uri vmserviceIo = outDirUri.resolve('vmservice_io.dill'); | 112 Uri vmserviceIo = outDirUri.resolve('vmservice_io.dill'); |
| 113 Uri librariesJson = outDirUri.resolve("lib/libraries.json"); | 113 Uri librariesJson = outDirUri.resolve("lib/libraries.json"); |
| 114 Uri packages = Uri.base.resolveUri(new Uri.file(packagesFile)); | 114 Uri packages = Uri.base.resolveUri(new Uri.file(packagesFile)); |
| 115 | 115 |
| 116 await _writeSync( | 116 await _writeSync( |
| 117 librariesJson.toFilePath(), JSON.encode({"libraries": locations})); | 117 librariesJson.toFilePath(), JSON.encode({"libraries": locations})); |
| 118 | 118 |
| 119 if (forVm) { | 119 if (forVm) { |
| 120 await fasta.compilePlatform(outDirUri, platform, | 120 await fasta.compilePlatform(outDirUri, platform, |
| 121 packages: packages, outlineOutput: outline); | 121 packages: packages, outlineOutput: outline); |
| 122 var base = path.fromUri(Platform.script); | |
| 123 Uri sdkDir = | |
|
Siggi Cherem (dart-lang)
2017/06/15 01:10:19
nit: rename to `repositoryDir`? `sdkDir` might be
sivachandra
2017/06/15 06:10:54
Done.
| |
| 124 new Uri.directory(path.dirname(path.dirname(path.absolute(base)))); | |
| 125 Uri vmserviceSdk = sdkDir.resolve('runtime/bin/vmservice_sdk/'); | |
|
Siggi Cherem (dart-lang)
2017/06/15 01:10:19
I'd like to eventually get rid of the fake vmservi
sivachandra
2017/06/15 06:10:54
Added the TODO.
| |
| 122 await fasta.compile([ | 126 await fasta.compile([ |
|
Siggi Cherem (dart-lang)
2017/06/15 01:10:19
now that this is independent of building the patch
sivachandra
2017/06/15 06:10:54
I considered that approach but decided against it
| |
| 123 "--sdk=${outDirUri.toString()}", | 127 "--sdk=${vmserviceSdk.toString()}", |
|
Siggi Cherem (dart-lang)
2017/06/15 01:10:19
FYI - I happen to just land a CL that updates thes
sivachandra
2017/06/15 06:10:54
Done.
| |
| 124 "--platform=${outline.toString()}", | 128 "--platform=${outline.toString()}", |
| 125 "--packages=${packages.toString()}", | 129 "--packages=${packages.toString()}", |
| 126 "dart:vmservice_io", | 130 "dart:vmservice_io", |
| 127 "-o", | 131 "-o", |
| 128 vmserviceIo.toString() | 132 vmserviceIo.toString() |
| 129 ]); | 133 ]); |
| 130 } else { | 134 } else { |
| 131 await dart2js.compilePlatform(outDirUri, platform, | 135 await dart2js.compilePlatform(outDirUri, platform, |
| 132 packages: packages, outlineOutput: outline); | 136 packages: packages, outlineOutput: outline); |
| 133 } | 137 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 ]) { | 200 ]) { |
| 197 var vmLibrary = tuple[0]; | 201 var vmLibrary = tuple[0]; |
| 198 var dartFile = tuple[1]; | 202 var dartFile = tuple[1]; |
| 199 | 203 |
| 200 // The "dart:_builtin" library is only available for the DartVM. | 204 // The "dart:_builtin" library is only available for the DartVM. |
| 201 var builtinLibraryIn = path.join(dartDir, 'runtime', 'bin', dartFile); | 205 var builtinLibraryIn = path.join(dartDir, 'runtime', 'bin', dartFile); |
| 202 var builtinLibraryOut = path.join(sdkOut, vmLibrary, '${vmLibrary}.dart'); | 206 var builtinLibraryOut = path.join(sdkOut, vmLibrary, '${vmLibrary}.dart'); |
| 203 _writeSync(builtinLibraryOut, readInputFile(builtinLibraryIn)); | 207 _writeSync(builtinLibraryOut, readInputFile(builtinLibraryIn)); |
| 204 locations[vmLibrary] = path.join(vmLibrary, '${vmLibrary}.dart'); | 208 locations[vmLibrary] = path.join(vmLibrary, '${vmLibrary}.dart'); |
| 205 } | 209 } |
| 206 | |
| 207 for (var file in ['loader.dart', 'server.dart', 'vmservice_io.dart']) { | |
| 208 var libraryIn = path.join(dartDir, 'runtime', 'bin', 'vmservice', file); | |
| 209 var libraryOut = path.join(sdkOut, 'vmservice_io', file); | |
| 210 _writeSync(libraryOut, readInputFile(libraryIn)); | |
| 211 } | |
| 212 locations["vmservice_io"] = "vmservice_io/vmservice_io.dart"; | |
| 213 locations["_vmservice"] = "vmservice/vmservice.dart"; | |
| 214 } | 210 } |
| 215 | 211 |
| 216 _applyPatch(SdkLibrary library, String sdkLibIn, String patchIn, String sdkOut, | 212 _applyPatch(SdkLibrary library, String sdkLibIn, String patchIn, String sdkOut, |
| 217 Map<String, String> locations) { | 213 Map<String, String> locations) { |
| 218 var libraryOut = path.join(sdkLibIn, library.path); | 214 var libraryOut = path.join(sdkLibIn, library.path); |
| 219 var libraryIn = libraryOut; | 215 var libraryIn = libraryOut; |
| 220 | 216 |
| 221 var libraryFile = getInputFile(libraryIn, canBeMissing: true); | 217 var libraryFile = getInputFile(libraryIn, canBeMissing: true); |
| 222 if (libraryFile != null) { | 218 if (libraryFile != null) { |
| 223 locations[Uri.parse(library.shortName).path] = | 219 locations[Uri.parse(library.shortName).path] = |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 619 if (diff != 0) return diff; | 615 if (diff != 0) return diff; |
| 620 return end - other.end; | 616 return end - other.end; |
| 621 } | 617 } |
| 622 } | 618 } |
| 623 | 619 |
| 624 List<SdkLibrary> _getSdkLibraries(String contents, bool useDart2js) { | 620 List<SdkLibrary> _getSdkLibraries(String contents, bool useDart2js) { |
| 625 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(useDart2js); | 621 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(useDart2js); |
| 626 parseCompilationUnit(contents).accept(libraryBuilder); | 622 parseCompilationUnit(contents).accept(libraryBuilder); |
| 627 return libraryBuilder.librariesMap.sdkLibraries; | 623 return libraryBuilder.librariesMap.sdkLibraries; |
| 628 } | 624 } |
| OLD | NEW |