OLD | NEW |
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/memory_file_system.dart'; | 7 import 'package:front_end/memory_file_system.dart'; |
8 import 'package:front_end/src/base/performace_logger.dart'; | 8 import 'package:front_end/src/base/performace_logger.dart'; |
9 import 'package:front_end/src/fasta/kernel/utils.dart'; | 9 import 'package:front_end/src/fasta/kernel/utils.dart'; |
10 import 'package:front_end/src/fasta/uri_translator_impl.dart'; | 10 import 'package:front_end/src/fasta/uri_translator_impl.dart'; |
11 import 'package:front_end/src/incremental/byte_store.dart'; | 11 import 'package:front_end/src/incremental/byte_store.dart'; |
12 import 'package:front_end/src/incremental/kernel_driver.dart'; | 12 import 'package:front_end/src/incremental/kernel_driver.dart'; |
13 import 'package:kernel/ast.dart'; | 13 import 'package:kernel/ast.dart'; |
14 import 'package:kernel/binary/ast_from_binary.dart'; | 14 import 'package:kernel/binary/ast_from_binary.dart'; |
15 import 'package:kernel/target/targets.dart'; | 15 import 'package:kernel/target/targets.dart'; |
16 import 'package:kernel/text/ast_to_text.dart'; | 16 import 'package:kernel/text/ast_to_text.dart'; |
17 import 'package:kernel/verifier.dart'; | 17 import 'package:kernel/verifier.dart'; |
| 18 import 'package:package_config/src/packages_impl.dart'; |
18 import 'package:test/test.dart'; | 19 import 'package:test/test.dart'; |
19 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 20 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
20 | 21 |
21 import 'mock_sdk.dart'; | 22 import 'mock_sdk.dart'; |
22 | 23 |
23 main() { | 24 main() { |
24 defineReflectiveSuite(() { | 25 defineReflectiveSuite(() { |
25 defineReflectiveTests(KernelDriverTest); | 26 defineReflectiveTests(KernelDriverTest); |
26 }); | 27 }); |
27 } | 28 } |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 } | 595 } |
595 for (var shouldExclude in excludes) { | 596 for (var shouldExclude in excludes) { |
596 expect(libraryUris, isNot(contains(shouldExclude))); | 597 expect(libraryUris, isNot(contains(shouldExclude))); |
597 } | 598 } |
598 } | 599 } |
599 | 600 |
600 /// Create new [KernelDriver] instance and put it into the [driver] field. | 601 /// Create new [KernelDriver] instance and put it into the [driver] field. |
601 void _createDriver( | 602 void _createDriver( |
602 {Map<String, Uri> packages, KernelDriverFileAddedFn fileAddedFn}) { | 603 {Map<String, Uri> packages, KernelDriverFileAddedFn fileAddedFn}) { |
603 Map<String, Uri> dartLibraries = createSdkFiles(fileSystem); | 604 Map<String, Uri> dartLibraries = createSdkFiles(fileSystem); |
604 var uriTranslator = new UriTranslatorImpl(dartLibraries, {}, packages); | 605 var uriTranslator = |
| 606 new UriTranslatorImpl(dartLibraries, {}, new MapPackages(packages)); |
605 driver = new KernelDriver( | 607 driver = new KernelDriver( |
606 new PerformanceLog(null), | 608 new PerformanceLog(null), |
607 fileSystem, | 609 fileSystem, |
608 new MemoryByteStore(), | 610 new MemoryByteStore(), |
609 uriTranslator, | 611 uriTranslator, |
610 new NoneTarget(new TargetFlags(strongMode: true)), | 612 new NoneTarget(new TargetFlags(strongMode: true)), |
611 fileAddedFn: fileAddedFn); | 613 fileAddedFn: fileAddedFn); |
612 } | 614 } |
613 | 615 |
614 Library _getLibrary(KernelResult result, Uri uri) { | 616 Library _getLibrary(KernelResult result, Uri uri) { |
(...skipping 18 matching lines...) Expand all Loading... |
633 .writeLibraryFile(library); | 635 .writeLibraryFile(library); |
634 return buffer.toString(); | 636 return buffer.toString(); |
635 } | 637 } |
636 | 638 |
637 /// Return the [Uri] for the given Posix [path]. | 639 /// Return the [Uri] for the given Posix [path]. |
638 static Uri _folderUri(String path) { | 640 static Uri _folderUri(String path) { |
639 if (!path.endsWith('/')) path += '/'; | 641 if (!path.endsWith('/')) path += '/'; |
640 return Uri.parse('file://$path'); | 642 return Uri.parse('file://$path'); |
641 } | 643 } |
642 } | 644 } |
OLD | NEW |