Skip to content

Commit

Permalink
[Tool] [Windows] Output build duration (#120311)
Browse files Browse the repository at this point in the history
* [Tool][Windows] Output build duration

* Tweak

* Format
  • Loading branch information
loic-sharma committed Feb 8, 2023
1 parent b4908f3 commit ef854a3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
33 changes: 31 additions & 2 deletions dev/devicelab/lib/tasks/run_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ TaskFunction createMacOSRunReleaseTest() {
}

TaskFunction createWindowsRunDebugTest() {
return DesktopRunOutputTest(
return WindowsRunOutputTest(
'${flutterDirectory.path}/dev/integration_tests/ui',
'lib/empty.dart',
release: false,
).call;
}

TaskFunction createWindowsRunReleaseTest() {
return DesktopRunOutputTest(
return WindowsRunOutputTest(
'${flutterDirectory.path}/dev/integration_tests/ui',
'lib/empty.dart',
release: true,
Expand Down Expand Up @@ -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 {
DesktopRunOutputTest(
super.testDirectory,
Expand All @@ -188,6 +212,8 @@ class DesktopRunOutputTest extends RunOutputTask {
'Launching $testTarget on',
);

verifyBuildOutput(stdout);

_findNextMatcherInList(
stdout,
(String line) => line.contains('Quit (terminate the application on the device).'),
Expand All @@ -202,6 +228,9 @@ class DesktopRunOutputTest extends RunOutputTask {

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.
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_tools/lib/src/windows/build_windows.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Future<void> buildWindows(WindowsProject windowsProject, BuildInfo buildInfo, {
}
await _runBuild(cmakePath, buildDirectory, buildModeName);
} finally {
status.cancel();
status.stop();
}
if (buildInfo.codeSizeDirectory != null && sizeAnalyzer != null) {
final String arch = getNameForTargetPlatform(TargetPlatform.windows_x64);
Expand Down

0 comments on commit ef854a3

Please sign in to comment.