diff --git a/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart b/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart index 7ec9748f6b5a..9a5e3c90f8fd 100644 --- a/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart +++ b/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart @@ -518,6 +518,7 @@ class ResidentWebRunner extends ResidentRunner { Completer 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; diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart index 0f1c3c698b27..1774909763e6 100644 --- a/packages/flutter_tools/lib/src/resident_runner.dart +++ b/packages/flutter_tools/lib/src/resident_runner.dart @@ -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 attach({ Completer connectionInfoCompleter, Completer appStartedCompleter, bool allowExistingDdsInstance = false, bool enableDevTools = false, + bool needsFullRestart = true, }); @override diff --git a/packages/flutter_tools/lib/src/run_cold.dart b/packages/flutter_tools/lib/src/run_cold.dart index 153e3b34849c..ebbcb57ac7e6 100644 --- a/packages/flutter_tools/lib/src/run_cold.dart +++ b/packages/flutter_tools/lib/src/run_cold.dart @@ -152,6 +152,7 @@ class ColdRunner extends ResidentRunner { Completer appStartedCompleter, bool allowExistingDdsInstance = false, bool enableDevTools = false, + bool needsFullRestart = true, }) async { _didAttach = true; try { diff --git a/packages/flutter_tools/lib/src/run_hot.dart b/packages/flutter_tools/lib/src/run_hot.dart index 5a0c0e856262..e2dfe5147cbb 100644 --- a/packages/flutter_tools/lib/src/run_hot.dart +++ b/packages/flutter_tools/lib/src/run_hot.dart @@ -228,6 +228,7 @@ class HotRunner extends ResidentRunner { Completer 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, ); } diff --git a/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart index 0674a2772871..2575d7f52790 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart @@ -477,6 +477,7 @@ class FakeHotRunner extends Fake implements HotRunner { Completer appStartedCompleter, bool allowExistingDdsInstance = false, bool enableDevTools = false, + bool needsFullRestart = true, }) { return onAttach(connectionInfoCompleter, appStartedCompleter, allowExistingDdsInstance, enableDevTools); } diff --git a/packages/flutter_tools/test/general.shard/hot_test.dart b/packages/flutter_tools/test/general.shard/hot_test.dart index f51cabfbba17..f68fbe0a3431 100644 --- a/packages/flutter_tools/test/general.shard/hot_test.dart +++ b/packages/flutter_tools/test/general.shard/hot_test.dart @@ -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: { HotRunnerConfig: () => TestHotRunnerConfig(), diff --git a/packages/flutter_tools/test/general.shard/terminal_handler_test.dart b/packages/flutter_tools/test/general.shard/terminal_handler_test.dart index fbf366d1708f..e9af1ef59c88 100644 --- a/packages/flutter_tools/test/general.shard/terminal_handler_test.dart +++ b/packages/flutter_tools/test/general.shard/terminal_handler_test.dart @@ -1467,6 +1467,7 @@ class TestRunner extends Fake implements ResidentRunner { Completer appStartedCompleter, bool allowExistingDdsInstance = false, bool enableDevTools = false, + bool needsFullRestart = true, }) async => null; }