[flutter_tools] add needsFullRestart flag on hot runner (#104562)
This commit is contained in:
parent
3f1f0a8170
commit
889a15eb9d
@ -518,6 +518,7 @@ class ResidentWebRunner extends ResidentRunner {
|
|||||||
Completer<void> appStartedCompleter,
|
Completer<void> appStartedCompleter,
|
||||||
bool allowExistingDdsInstance = false,
|
bool allowExistingDdsInstance = false,
|
||||||
bool enableDevTools = false, // ignored, we don't yet support devtools for web
|
bool enableDevTools = false, // ignored, we don't yet support devtools for web
|
||||||
|
bool needsFullRestart = true,
|
||||||
}) async {
|
}) async {
|
||||||
if (_chromiumLauncher != null) {
|
if (_chromiumLauncher != null) {
|
||||||
final Chromium chrome = await _chromiumLauncher.connectedInstance;
|
final Chromium chrome = await _chromiumLauncher.connectedInstance;
|
||||||
|
@ -1178,11 +1178,16 @@ abstract class ResidentRunner extends ResidentHandlers {
|
|||||||
String route,
|
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({
|
Future<int> attach({
|
||||||
Completer<DebugConnectionInfo> connectionInfoCompleter,
|
Completer<DebugConnectionInfo> connectionInfoCompleter,
|
||||||
Completer<void> appStartedCompleter,
|
Completer<void> appStartedCompleter,
|
||||||
bool allowExistingDdsInstance = false,
|
bool allowExistingDdsInstance = false,
|
||||||
bool enableDevTools = false,
|
bool enableDevTools = false,
|
||||||
|
bool needsFullRestart = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -152,6 +152,7 @@ class ColdRunner extends ResidentRunner {
|
|||||||
Completer<void> appStartedCompleter,
|
Completer<void> appStartedCompleter,
|
||||||
bool allowExistingDdsInstance = false,
|
bool allowExistingDdsInstance = false,
|
||||||
bool enableDevTools = false,
|
bool enableDevTools = false,
|
||||||
|
bool needsFullRestart = true,
|
||||||
}) async {
|
}) async {
|
||||||
_didAttach = true;
|
_didAttach = true;
|
||||||
try {
|
try {
|
||||||
|
@ -228,6 +228,7 @@ class HotRunner extends ResidentRunner {
|
|||||||
Completer<void> appStartedCompleter,
|
Completer<void> appStartedCompleter,
|
||||||
bool allowExistingDdsInstance = false,
|
bool allowExistingDdsInstance = false,
|
||||||
bool enableDevTools = false,
|
bool enableDevTools = false,
|
||||||
|
bool needsFullRestart = true,
|
||||||
}) async {
|
}) async {
|
||||||
_didAttach = true;
|
_didAttach = true;
|
||||||
try {
|
try {
|
||||||
@ -276,7 +277,7 @@ class HotRunner extends ResidentRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Stopwatch initialUpdateDevFSsTimer = Stopwatch()..start();
|
final Stopwatch initialUpdateDevFSsTimer = Stopwatch()..start();
|
||||||
final UpdateFSReport devfsResult = await _updateDevFS(fullRestart: true);
|
final UpdateFSReport devfsResult = await _updateDevFS(fullRestart: needsFullRestart);
|
||||||
_addBenchmarkData(
|
_addBenchmarkData(
|
||||||
'hotReloadInitialDevFSSyncMilliseconds',
|
'hotReloadInitialDevFSSyncMilliseconds',
|
||||||
initialUpdateDevFSsTimer.elapsed.inMilliseconds,
|
initialUpdateDevFSsTimer.elapsed.inMilliseconds,
|
||||||
@ -436,6 +437,7 @@ class HotRunner extends ResidentRunner {
|
|||||||
connectionInfoCompleter: connectionInfoCompleter,
|
connectionInfoCompleter: connectionInfoCompleter,
|
||||||
appStartedCompleter: appStartedCompleter,
|
appStartedCompleter: appStartedCompleter,
|
||||||
enableDevTools: enableDevTools,
|
enableDevTools: enableDevTools,
|
||||||
|
needsFullRestart: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,6 +477,7 @@ class FakeHotRunner extends Fake implements HotRunner {
|
|||||||
Completer<void> appStartedCompleter,
|
Completer<void> appStartedCompleter,
|
||||||
bool allowExistingDdsInstance = false,
|
bool allowExistingDdsInstance = false,
|
||||||
bool enableDevTools = false,
|
bool enableDevTools = false,
|
||||||
|
bool needsFullRestart = true,
|
||||||
}) {
|
}) {
|
||||||
return onAttach(connectionInfoCompleter, appStartedCompleter, allowExistingDdsInstance, enableDevTools);
|
return onAttach(connectionInfoCompleter, appStartedCompleter, allowExistingDdsInstance, enableDevTools);
|
||||||
}
|
}
|
||||||
|
@ -514,7 +514,7 @@ void main() {
|
|||||||
final int exitCode = await HotRunner(devices,
|
final int exitCode = await HotRunner(devices,
|
||||||
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
|
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
|
||||||
target: 'main.dart',
|
target: 'main.dart',
|
||||||
).attach();
|
).attach(needsFullRestart: false);
|
||||||
expect(exitCode, 2);
|
expect(exitCode, 2);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
HotRunnerConfig: () => TestHotRunnerConfig(),
|
HotRunnerConfig: () => TestHotRunnerConfig(),
|
||||||
|
@ -1467,6 +1467,7 @@ class TestRunner extends Fake implements ResidentRunner {
|
|||||||
Completer<void> appStartedCompleter,
|
Completer<void> appStartedCompleter,
|
||||||
bool allowExistingDdsInstance = false,
|
bool allowExistingDdsInstance = false,
|
||||||
bool enableDevTools = false,
|
bool enableDevTools = false,
|
||||||
|
bool needsFullRestart = true,
|
||||||
}) async => null;
|
}) async => null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user