| Index: test/codegen_test.dart
|
| diff --git a/test/codegen_test.dart b/test/codegen_test.dart
|
| index d16305e9b6d41899b0ecf8855cf2fd8ef7bfe43b..c2f4d749ccab7dba130f2587f6574b18133dd51b 100644
|
| --- a/test/codegen_test.dart
|
| +++ b/test/codegen_test.dart
|
| @@ -161,12 +161,14 @@ void _buildPackages(ModuleCompiler compiler, String expectDir) {
|
| void _buildMatcher(ModuleCompiler compiler, String expectDir) {
|
| var options = new CompilerOptions(sourceMap: false, summarizeApi: false);
|
|
|
| - var filePath = path.join(inputDir, 'packages', 'matcher', 'matcher.dart');
|
| + var packageRoot = path.join(inputDir, 'packages');
|
| + var filePath = path.join(packageRoot, 'matcher', 'matcher.dart');
|
| var contents = new File(filePath).readAsStringSync();
|
|
|
| // Collect any other files we've imported.
|
| var files = new Set<String>();
|
| - _collectTransitiveImports(contents, files, from: filePath);
|
| + _collectTransitiveImports(contents, files,
|
| + packageRoot: packageRoot, from: filePath);
|
|
|
| var unit = new BuildUnit('matcher', files.toList(), _moduleForLibrary);
|
| var module = compiler.compile(unit, options);
|
| @@ -247,8 +249,12 @@ Iterable<String> _findTests(String dir, RegExp filePattern) {
|
| ///
|
| /// This will not include dart:* libraries, as those are implicitly available.
|
| void _collectTransitiveImports(String contents, Set<String> libraries,
|
| - {String from}) {
|
| - if (!libraries.add(from)) return;
|
| + {String packageRoot, String from}) {
|
| + var uri = from;
|
| + if (packageRoot != null && path.isWithin(packageRoot, from)) {
|
| + uri = 'package:${path.relative(from, from: packageRoot)}';
|
| + }
|
| + if (!libraries.add(uri)) return;
|
|
|
| var unit = parseDirectives(contents, name: from, suppressErrors: true);
|
| for (var d in unit.directives) {
|
| @@ -263,7 +269,7 @@ void _collectTransitiveImports(String contents, Set<String> libraries,
|
| var f = new File(path.join(path.dirname(from), uri));
|
| if (f.existsSync()) {
|
| _collectTransitiveImports(f.readAsStringSync(), libraries,
|
| - from: f.path);
|
| + packageRoot: packageRoot, from: f.path);
|
| }
|
| }
|
| }
|
|
|