Reland: enable usage of experimental web compiler (#44400)
This commit is contained in:
@@ -6,5 +6,5 @@ import 'package:flutter_devicelab/framework/framework.dart';
|
||||
import 'package:flutter_devicelab/tasks/web_dev_mode_tests.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
await task(createWebDevModeTest());
|
||||
await task(createWebDevModeTest(WebDevice.webServer, false));
|
||||
}
|
||||
|
||||
@@ -6,5 +6,5 @@ import 'package:flutter_devicelab/framework/framework.dart';
|
||||
import 'package:flutter_devicelab/tasks/web_dev_mode_tests.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
await task(createWebDevModeTest());
|
||||
await task(createWebDevModeTest(WebDevice.webServer, false));
|
||||
}
|
||||
|
||||
10
dev/devicelab/bin/tasks/web_incremental_test.dart
Normal file
10
dev/devicelab/bin/tasks/web_incremental_test.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
import 'package:flutter_devicelab/tasks/web_dev_mode_tests.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
await task(createWebDevModeTest(WebDevice.chrome, true));
|
||||
}
|
||||
@@ -6,5 +6,5 @@ import 'package:flutter_devicelab/framework/framework.dart';
|
||||
import 'package:flutter_devicelab/tasks/web_dev_mode_tests.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
await task(createWebDevModeTest());
|
||||
await task(createWebDevModeTest(WebDevice.webServer, false));
|
||||
}
|
||||
|
||||
@@ -20,12 +20,21 @@ const String kFirstRecompileTime = 'FirstRecompileTime';
|
||||
const String kSecondStartupTime = 'SecondStartupTime';
|
||||
const String kSecondRestartTime = 'SecondRestartTime';
|
||||
|
||||
TaskFunction createWebDevModeTest() {
|
||||
|
||||
abstract class WebDevice {
|
||||
static const String chrome = 'chrome';
|
||||
static const String webServer = 'web-server';
|
||||
}
|
||||
|
||||
TaskFunction createWebDevModeTest(String webDevice, bool enableIncrementalCompiler) {
|
||||
return () async {
|
||||
final List<String> options = <String>[
|
||||
'--hot', '-d', 'web-server', '--verbose', '--resident', '--target=lib/main.dart',
|
||||
'--hot', '-d', webDevice, '--verbose', '--resident', '--target=lib/main.dart',
|
||||
];
|
||||
int hotRestartCount = 0;
|
||||
final String expectedMessage = webDevice == WebDevice.webServer
|
||||
? 'Recompile complete'
|
||||
: 'Reloaded application';
|
||||
final Map<String, int> measurements = <String, int>{};
|
||||
await inDirectory<void>(flutterDirectory, () async {
|
||||
rmTree(_editedFlutterGalleryDir);
|
||||
@@ -38,6 +47,8 @@ TaskFunction createWebDevModeTest() {
|
||||
<String>['packages', 'get'],
|
||||
environment: <String, String>{
|
||||
'FLUTTER_WEB': 'true',
|
||||
if (enableIncrementalCompiler)
|
||||
'WEB_INCREMENTAL_COMPILER': 'true',
|
||||
},
|
||||
);
|
||||
await packagesGet.exitCode;
|
||||
@@ -46,16 +57,26 @@ TaskFunction createWebDevModeTest() {
|
||||
flutterCommandArgs('run', options),
|
||||
environment: <String, String>{
|
||||
'FLUTTER_WEB': 'true',
|
||||
if (enableIncrementalCompiler)
|
||||
'WEB_INCREMENTAL_COMPILER': 'true',
|
||||
},
|
||||
);
|
||||
|
||||
final Completer<void> stdoutDone = Completer<void>();
|
||||
final Completer<void> stderrDone = Completer<void>();
|
||||
final Stopwatch sw = Stopwatch()..start();
|
||||
bool restarted = false;
|
||||
process.stdout
|
||||
.transform<String>(utf8.decoder)
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen((String line) {
|
||||
// TODO(jonahwilliams): non-dwds builds do not know when the browser is loaded.
|
||||
if (line.contains('Ignoring terminal input')) {
|
||||
Future<void>.delayed(const Duration(seconds: 1)).then((void _) {
|
||||
process.stdin.write(restarted ? 'q' : 'r');
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (line.contains('To hot restart')) {
|
||||
// measure clean start-up time.
|
||||
sw.stop();
|
||||
@@ -63,9 +84,10 @@ TaskFunction createWebDevModeTest() {
|
||||
sw
|
||||
..reset()
|
||||
..start();
|
||||
process.stdin.write('R');
|
||||
process.stdin.write('r');
|
||||
return;
|
||||
}
|
||||
if (line.contains('Recompile complete')) {
|
||||
if (line.contains(expectedMessage)) {
|
||||
if (hotRestartCount == 0) {
|
||||
measurements[kFirstRestartTime] = sw.elapsedMilliseconds;
|
||||
// Update the file and reload again.
|
||||
@@ -80,9 +102,10 @@ TaskFunction createWebDevModeTest() {
|
||||
sw
|
||||
..reset()
|
||||
..start();
|
||||
process.stdin.writeln('R');
|
||||
process.stdin.writeln('r');
|
||||
++hotRestartCount;
|
||||
} else {
|
||||
restarted = true;
|
||||
measurements[kFirstRecompileTime] = sw.elapsedMilliseconds;
|
||||
// Quit after second hot restart.
|
||||
process.stdin.writeln('q');
|
||||
@@ -119,24 +142,35 @@ TaskFunction createWebDevModeTest() {
|
||||
flutterCommandArgs('run', options),
|
||||
environment: <String, String>{
|
||||
'FLUTTER_WEB': 'true',
|
||||
if (enableIncrementalCompiler)
|
||||
'WEB_INCREMENTAL_COMPILER': 'true',
|
||||
},
|
||||
);
|
||||
final Completer<void> stdoutDone = Completer<void>();
|
||||
final Completer<void> stderrDone = Completer<void>();
|
||||
bool restarted = false;
|
||||
process.stdout
|
||||
.transform<String>(utf8.decoder)
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen((String line) {
|
||||
|
||||
// TODO(jonahwilliams): non-dwds builds do not know when the browser is loaded.
|
||||
if (line.contains('Ignoring terminal input')) {
|
||||
Future<void>.delayed(const Duration(seconds: 1)).then((void _) {
|
||||
process.stdin.write(restarted ? 'q' : 'r');
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (line.contains('To hot restart')) {
|
||||
measurements[kSecondStartupTime] = sw.elapsedMilliseconds;
|
||||
sw
|
||||
..reset()
|
||||
..start();
|
||||
process.stdin.write('R');
|
||||
process.stdin.write('r');
|
||||
return;
|
||||
}
|
||||
if (line.contains('Recompile complete')) {
|
||||
measurements[kSecondRestartTime] = sw.elapsedMilliseconds;
|
||||
if (line.contains(expectedMessage)) {
|
||||
restarted = true;
|
||||
measurements[kSecondRestartTime] = sw.elapsedMilliseconds;
|
||||
process.stdin.writeln('q');
|
||||
}
|
||||
print('stdout: $line');
|
||||
|
||||
@@ -112,6 +112,13 @@ tasks:
|
||||
stage: devicelab
|
||||
required_agent_capabilities: ["linux/android"]
|
||||
|
||||
web_incremental_test:
|
||||
description: >
|
||||
Verify that the experimental frontend server support is functional.
|
||||
stage: devicelab
|
||||
required_agent_capabilities: ["linux/android"]
|
||||
flaky: true
|
||||
|
||||
flutter_gallery_ios__compile:
|
||||
description: >
|
||||
Collects various performance metrics of compiling the Flutter
|
||||
|
||||
Reference in New Issue
Block a user