提交 94c5b9f7 编写于 作者: N Nurhan Turgut 提交者: Flutter GitHub Bot

modify test_runner.dart for windows to fix test build errors (#15326)

上级 5272d12e
......@@ -60,6 +60,12 @@ class TestCommand extends Command<bool> {
_copyTestFontsIntoWebUi();
await _buildHostPage();
if (io.Platform.isWindows) {
// On Dart 2.7 or greater, it gives an error for not
// recognized "pub" version and asks for "pub" get.
// See: https://github.com/dart-lang/sdk/issues/39738
await _runPubGet();
}
final List<FilePath> targets =
this.targets.map((t) => FilePath.fromCwd(t)).toList();
......@@ -162,7 +168,9 @@ class TestCommand extends Command<bool> {
// Not a test file at all. Skip.
continue;
}
if(!path.split(testFilePath.relativeToWebUi).contains('golden_tests')) {
if (!path
.split(testFilePath.relativeToWebUi)
.contains('golden_tests')) {
unitTestFiles.add(testFilePath);
}
}
......@@ -179,6 +187,22 @@ class TestCommand extends Command<bool> {
}
}
Future<void> _runPubGet() async {
final int exitCode = await runProcess(
environment.pubExecutable,
<String>[
'get',
],
workingDirectory: environment.webUiRootDir.path,
);
if (exitCode != 0) {
io.stderr
.writeln('Failed to run pub get. Exited with exit code $exitCode');
io.exit(1);
}
}
Future<void> _buildHostPage() async {
final String hostDartPath = path.join('lib', 'static', 'host.dart');
final io.File hostDartFile = io.File(path.join(
......
......@@ -43,6 +43,9 @@ Future<int> runProcess(
executable,
arguments,
workingDirectory: workingDirectory,
// Running the process in a system shell for Windows. Otherwise
// the process is not able to get Dart from path.
runInShell: io.Platform.isWindows,
mode: io.ProcessStartMode.inheritStdio,
);
final int exitCode = await process.exitCode;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册