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

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

Issue 2986303003: Switch FE to use the libraries.json format. (Closed)
Patch Set: fix issues found on bots 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..b4b8d81c295c10f08567c484bdf0d8201718b4c3 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_specification.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');
+ fileSystem.entityForUri(uri).writeAsStringSync(spec.toJsonString(uri));
+ return targetSpec;
}
« no previous file with comments | « pkg/front_end/test/src/incremental/kernel_driver_test.dart ('k') | pkg/front_end/test/subpackage_relationships_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698