Unverified Commit 889a15eb authored by Jesús S Guerrero's avatar Jesús S Guerrero Committed by GitHub

[flutter_tools] add needsFullRestart flag on hot runner (#104562)

parent 3f1f0a81
......@@ -518,6 +518,7 @@ class ResidentWebRunner extends ResidentRunner {
Completer<void> appStartedCompleter,
bool allowExistingDdsInstance = false,
bool enableDevTools = false, // ignored, we don't yet support devtools for web
bool needsFullRestart = true,
}) async {
if (_chromiumLauncher != null) {
final Chromium chrome = await _chromiumLauncher.connectedInstance;
......
......@@ -1178,11 +1178,16 @@ abstract class ResidentRunner extends ResidentHandlers {
String route,
});
/// Connect to a flutter application.
///
/// [needsFullRestart] defaults to `true`, and controls if the frontend server should
/// compile a full dill. This should be set to `false` if this is called in [ResidentRunner.run], since that method already perfoms an initial compilation.
Future<int> attach({
Completer<DebugConnectionInfo> connectionInfoCompleter,
Completer<void> appStartedCompleter,
bool allowExistingDdsInstance = false,
bool enableDevTools = false,
bool needsFullRestart = true,
});
@override
......
......@@ -152,6 +152,7 @@ class ColdRunner extends ResidentRunner {
Completer<void> appStartedCompleter,
bool allowExistingDdsInstance = false,
bool enableDevTools = false,
bool needsFullRestart = true,
}) async {
_didAttach = true;
try {
......
......@@ -228,6 +228,7 @@ class HotRunner extends ResidentRunner {
Completer<void> appStartedCompleter,
bool allowExistingDdsInstance = false,
bool enableDevTools = false,
bool needsFullRestart = true,
}) async {
_didAttach = true;
try {
......@@ -276,7 +277,7 @@ class HotRunner extends ResidentRunner {
}
final Stopwatch initialUpdateDevFSsTimer = Stopwatch()..start();
final UpdateFSReport devfsResult = await _updateDevFS(fullRestart: true);
final UpdateFSReport devfsResult = await _updateDevFS(fullRestart: needsFullRestart);
_addBenchmarkData(
'hotReloadInitialDevFSSyncMilliseconds',
initialUpdateDevFSsTimer.elapsed.inMilliseconds,
......@@ -436,6 +437,7 @@ class HotRunner extends ResidentRunner {
connectionInfoCompleter: connectionInfoCompleter,
appStartedCompleter: appStartedCompleter,
enableDevTools: enableDevTools,
needsFullRestart: false,
);
}
......
......@@ -477,6 +477,7 @@ class FakeHotRunner extends Fake implements HotRunner {
Completer<void> appStartedCompleter,
bool allowExistingDdsInstance = false,
bool enableDevTools = false,
bool needsFullRestart = true,
}) {
return onAttach(connectionInfoCompleter, appStartedCompleter, allowExistingDdsInstance, enableDevTools);
}
......
......@@ -514,7 +514,7 @@ void main() {
final int exitCode = await HotRunner(devices,
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
target: 'main.dart',
).attach();
).attach(needsFullRestart: false);
expect(exitCode, 2);
}, overrides: <Type, Generator>{
HotRunnerConfig: () => TestHotRunnerConfig(),
......
......@@ -1467,6 +1467,7 @@ class TestRunner extends Fake implements ResidentRunner {
Completer<void> appStartedCompleter,
bool allowExistingDdsInstance = false,
bool enableDevTools = false,
bool needsFullRestart = true,
}) async => null;
}
......
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