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 25 matching lines...) Expand all Loading... |
36 /// For more information see GN and Ninja references: | 36 /// For more information see GN and Ninja references: |
37 /// https://chromium.googlesource.com/chromium/src/+/56807c6cb383140af0c03da8
f6731d77785d7160/tools/gn/docs/reference.md#depfile_string_File-name-for-input-d
ependencies-for-actions | 37 /// https://chromium.googlesource.com/chromium/src/+/56807c6cb383140af0c03da8
f6731d77785d7160/tools/gn/docs/reference.md#depfile_string_File-name-for-input-d
ependencies-for-actions |
38 /// https://ninja-build.org/manual.html#_depfile | 38 /// https://ninja-build.org/manual.html#_depfile |
39 /// | 39 /// |
40 final deps = new Set<Uri>(); | 40 final deps = new Set<Uri>(); |
41 | 41 |
42 /// Create [File] object from the given path and register it as a dependency. | 42 /// Create [File] object from the given path and register it as a dependency. |
43 File getInputFile(String path, {canBeMissing: false}) { | 43 File getInputFile(String path, {canBeMissing: false}) { |
44 final file = new File(path); | 44 final file = new File(path); |
45 if (!file.existsSync()) { | 45 if (!file.existsSync()) { |
46 if (!canBeMissing) throw "patch_sdk.dart expects all inputs to exist"; | 46 if (!canBeMissing) |
| 47 throw "patch_sdk.dart expects all inputs to exist, missing: $path"; |
47 return null; | 48 return null; |
48 } | 49 } |
49 deps.add(Uri.base.resolveUri(file.uri)); | 50 deps.add(Uri.base.resolveUri(file.uri)); |
50 return file; | 51 return file; |
51 } | 52 } |
52 | 53 |
53 /// Read the given file synchronously as a string and register this path as | 54 /// Read the given file synchronously as a string and register this path as |
54 /// a dependency. | 55 /// a dependency. |
55 String readInputFile(String path, {canBeMissing: false}) => | 56 String readInputFile(String path, {canBeMissing: false}) => |
56 getInputFile(path, canBeMissing: canBeMissing)?.readAsStringSync(); | 57 getInputFile(path, canBeMissing: canBeMissing)?.readAsStringSync(); |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(forDart2js); | 823 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(forDart2js); |
823 parseCompilationUnit(contents).accept(libraryBuilder); | 824 parseCompilationUnit(contents).accept(libraryBuilder); |
824 return libraryBuilder.librariesMap.sdkLibraries; | 825 return libraryBuilder.librariesMap.sdkLibraries; |
825 } | 826 } |
826 | 827 |
827 void addLocation(Map<String, Map<String, String>> locations, String libraryName, | 828 void addLocation(Map<String, Map<String, String>> locations, String libraryName, |
828 String libraryPath) { | 829 String libraryPath) { |
829 assert(locations[libraryName] == null); | 830 assert(locations[libraryName] == null); |
830 locations[libraryName] = {'uri': '${path.toUri(libraryPath)}'}; | 831 locations[libraryName] = {'uri': '${path.toUri(libraryPath)}'}; |
831 } | 832 } |
OLD | NEW |