[flutter_tools] ensure desktop builds can run without flutter_tools' package_config (#62426)

This commit is contained in:
Jonah Williams
2020-07-28 18:36:05 -07:00
committed by GitHub
parent 50828a1318
commit 78efd3eb46
2 changed files with 28 additions and 5 deletions

View File

@@ -210,6 +210,16 @@ void main() {
}
}
});
test('no import of packages in tool_backend.dart', () {
final File file = globals.fs.file(globals.fs.path.join(flutterTools, 'bin', 'tool_backend.dart'));
for (final String line in file.readAsLinesSync()) {
if (line.startsWith(RegExp(r'import.*package:.*'))) {
final String relativePath = globals.fs.path.relative(file.path, from:flutterTools);
fail('$relativePath imports a package');
}
}
});
}
bool _isDartFile(FileSystemEntity entity) => entity is File && entity.path.endsWith('.dart');