Unverified Commit ef854a3d authored by Loïc Sharma's avatar Loïc Sharma Committed by GitHub

[Tool] [Windows] Output build duration (#120311)

* [Tool][Windows] Output build duration

* Tweak

* Format
parent b4908f37
...@@ -58,7 +58,7 @@ TaskFunction createMacOSRunReleaseTest() { ...@@ -58,7 +58,7 @@ TaskFunction createMacOSRunReleaseTest() {
} }
TaskFunction createWindowsRunDebugTest() { TaskFunction createWindowsRunDebugTest() {
return DesktopRunOutputTest( return WindowsRunOutputTest(
'${flutterDirectory.path}/dev/integration_tests/ui', '${flutterDirectory.path}/dev/integration_tests/ui',
'lib/empty.dart', 'lib/empty.dart',
release: false, release: false,
...@@ -66,7 +66,7 @@ TaskFunction createWindowsRunDebugTest() { ...@@ -66,7 +66,7 @@ TaskFunction createWindowsRunDebugTest() {
} }
TaskFunction createWindowsRunReleaseTest() { TaskFunction createWindowsRunReleaseTest() {
return DesktopRunOutputTest( return WindowsRunOutputTest(
'${flutterDirectory.path}/dev/integration_tests/ui', '${flutterDirectory.path}/dev/integration_tests/ui',
'lib/empty.dart', 'lib/empty.dart',
release: true, release: true,
...@@ -164,6 +164,30 @@ class AndroidRunOutputTest extends RunOutputTask { ...@@ -164,6 +164,30 @@ class AndroidRunOutputTest extends RunOutputTask {
} }
} }
class WindowsRunOutputTest extends DesktopRunOutputTest {
WindowsRunOutputTest(
super.testDirectory,
super.testTarget, {
required super.release,
super.allowStderr = false,
}
);
static final RegExp _buildOutput = RegExp(
r'Building Windows application\.\.\.\s*\d+(\.\d+)?(ms|s)',
multiLine: true,
);
@override
void verifyBuildOutput(List<String> stdout) {
_findNextMatcherInList(
stdout,
_buildOutput.hasMatch,
'Building Windows application...',
);
}
}
class DesktopRunOutputTest extends RunOutputTask { class DesktopRunOutputTest extends RunOutputTask {
DesktopRunOutputTest( DesktopRunOutputTest(
super.testDirectory, super.testDirectory,
...@@ -188,6 +212,8 @@ class DesktopRunOutputTest extends RunOutputTask { ...@@ -188,6 +212,8 @@ class DesktopRunOutputTest extends RunOutputTask {
'Launching $testTarget on', 'Launching $testTarget on',
); );
verifyBuildOutput(stdout);
_findNextMatcherInList( _findNextMatcherInList(
stdout, stdout,
(String line) => line.contains('Quit (terminate the application on the device).'), (String line) => line.contains('Quit (terminate the application on the device).'),
...@@ -202,6 +228,9 @@ class DesktopRunOutputTest extends RunOutputTask { ...@@ -202,6 +228,9 @@ class DesktopRunOutputTest extends RunOutputTask {
return TaskResult.success(null); return TaskResult.success(null);
} }
/// Verify the output from `flutter run`'s build step.
void verifyBuildOutput(List<String> stdout) {}
} }
/// Test that the output of `flutter run` is expected. /// Test that the output of `flutter run` is expected.
......
...@@ -90,7 +90,7 @@ Future<void> buildWindows(WindowsProject windowsProject, BuildInfo buildInfo, { ...@@ -90,7 +90,7 @@ Future<void> buildWindows(WindowsProject windowsProject, BuildInfo buildInfo, {
} }
await _runBuild(cmakePath, buildDirectory, buildModeName); await _runBuild(cmakePath, buildDirectory, buildModeName);
} finally { } finally {
status.cancel(); status.stop();
} }
if (buildInfo.codeSizeDirectory != null && sizeAnalyzer != null) { if (buildInfo.codeSizeDirectory != null && sizeAnalyzer != null) {
final String arch = getNameForTargetPlatform(TargetPlatform.windows_x64); final String arch = getNameForTargetPlatform(TargetPlatform.windows_x64);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment