Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Unified Diff: pkg/front_end/test/src/incremental/mock_sdk.dart

Issue 2986303003: Switch FE to use the libraries.json format. (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/test/src/incremental/mock_sdk.dart
diff --git a/pkg/front_end/test/src/incremental/mock_sdk.dart b/pkg/front_end/test/src/incremental/mock_sdk.dart
index b005e2606c37c7b1676149e5e7c9c04d014257c7..fda1c39a95ced18fd86e9dc0abaa18ef1362bbe5 100644
--- a/pkg/front_end/test/src/incremental/mock_sdk.dart
+++ b/pkg/front_end/test/src/incremental/mock_sdk.dart
@@ -3,18 +3,21 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:front_end/memory_file_system.dart';
+import 'package:front_end/src/base/libraries_spec.dart';
/// Create SDK libraries which are used by Fasta to perform kernel generation.
-/// Return the mapping from the simple names of these library to the URIs
-/// in the given [fileSystem]. The root of the SDK is `file:///sdk`.
-Map<String, Uri> createSdkFiles(MemoryFileSystem fileSystem) {
- Map<String, Uri> dartLibraries = {};
-
+/// The root of the SDK is `file:///sdk`, it will contain a libraries
+/// specification file at `lib/libraries.json`.
+///
+/// Returns the [TargetLibrariesSpecification] whose contents are in
+/// libraries.json.
+TargetLibrariesSpecification createSdkFiles(MemoryFileSystem fileSystem) {
+ Map<String, LibraryInfo> dartLibraries = {};
void addSdkLibrary(String name, String contents) {
String path = '$name/$name.dart';
Uri uri = Uri.parse('file:///sdk/lib/$path');
fileSystem.entityForUri(uri).writeAsStringSync(contents);
- dartLibraries[name] = uri;
+ dartLibraries[name] = new LibraryInfo(name, uri, const []);
}
addSdkLibrary('core', r'''
@@ -265,5 +268,10 @@ class ExternalName {
''');
addSdkLibrary('_vmservice', 'library dart._vmservice;');
- return dartLibraries;
+ var targetSpec = new TargetLibrariesSpecification('vm', dartLibraries);
+ var spec = new LibrariesSpecification({'vm': targetSpec});
+
+ Uri uri = Uri.parse('file:///sdk/lib/libraries.json');
ahe 2017/08/03 11:58:16 :-(
Siggi Cherem (dart-lang) 2017/08/05 00:41:02 ditto
+ fileSystem.entityForUri(uri).writeAsStringSync(spec.toJsonString(uri));
+ return targetSpec;
}

Powered by Google App Engine
This is Rietveld 408576698