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

Side by Side Diff: pkg/front_end/test/incremental_kernel_generator_test.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:front_end/compiler_options.dart'; 7 import 'package:front_end/compiler_options.dart';
8 import 'package:front_end/incremental_kernel_generator.dart'; 8 import 'package:front_end/incremental_kernel_generator.dart';
9 import 'package:front_end/memory_file_system.dart'; 9 import 'package:front_end/memory_file_system.dart';
10 import 'package:front_end/src/incremental/byte_store.dart'; 10 import 'package:front_end/src/incremental/byte_store.dart';
(...skipping 18 matching lines...) Expand all
29 29
30 /// The used file watcher. 30 /// The used file watcher.
31 WatchUsedFilesFn watchFn = (uri, used) {}; 31 WatchUsedFilesFn watchFn = (uri, used) {};
32 32
33 /// The object under test. 33 /// The object under test.
34 IncrementalKernelGeneratorImpl incrementalKernelGenerator; 34 IncrementalKernelGeneratorImpl incrementalKernelGenerator;
35 35
36 /// Compute the initial [Program] for the given [entryPoint]. 36 /// Compute the initial [Program] for the given [entryPoint].
37 Future<Program> getInitialState(Uri entryPoint, 37 Future<Program> getInitialState(Uri entryPoint,
38 {bool setPackages: true}) async { 38 {bool setPackages: true}) async {
39 Map<String, Uri> dartLibraries = createSdkFiles(fileSystem); 39 createSdkFiles(fileSystem);
40 // TODO(scheglov) Builder the SDK kernel and set it into the options. 40 // TODO(scheglov) Builder the SDK kernel and set it into the options.
41 41
42 // TODO(scheglov) Make `.packages` file optional.
43
44 var compilerOptions = new CompilerOptions() 42 var compilerOptions = new CompilerOptions()
45 ..fileSystem = fileSystem 43 ..fileSystem = fileSystem
46 ..byteStore = new MemoryByteStore() 44 ..byteStore = new MemoryByteStore()
47 // ..logger = new PerformanceLog(stdout) 45 // ..logger = new PerformanceLog(stdout)
48 ..strongMode = true 46 ..strongMode = true
49 ..chaseDependencies = true 47 ..chaseDependencies = true
50 ..dartLibraries = dartLibraries; 48 ..librariesSpecUri = Uri.parse('file:///sdk/lib/libraries.json');
ahe 2017/08/03 11:58:16 Ditto.
Siggi Cherem (dart-lang) 2017/08/05 00:41:02 Similarly, this tests relies on the file://* schem
51 49
52 if (setPackages) { 50 if (setPackages) {
53 compilerOptions.packagesFileUri = Uri.parse('file:///test/.packages'); 51 compilerOptions.packagesFileUri = Uri.parse('file:///test/.packages');
54 } 52 }
55 incrementalKernelGenerator = await IncrementalKernelGenerator 53 incrementalKernelGenerator = await IncrementalKernelGenerator
56 .newInstance(compilerOptions, entryPoint, watch: watchFn); 54 .newInstance(compilerOptions, entryPoint, watch: watchFn);
57 return (await incrementalKernelGenerator.computeDelta()).newProgram; 55 return (await incrementalKernelGenerator.computeDelta()).newProgram;
58 } 56 }
59 57
60 test_compile_chain() async { 58 test_compile_chain() async {
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 throw fail('No library found with URI "$uri"'); 378 throw fail('No library found with URI "$uri"');
381 } 379 }
382 380
383 String _getLibraryText(Library library) { 381 String _getLibraryText(Library library) {
384 StringBuffer buffer = new StringBuffer(); 382 StringBuffer buffer = new StringBuffer();
385 new Printer(buffer, syntheticNames: new NameSystem()) 383 new Printer(buffer, syntheticNames: new NameSystem())
386 .writeLibraryFile(library); 384 .writeLibraryFile(library);
387 return buffer.toString(); 385 return buffer.toString();
388 } 386 }
389 } 387 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698