Remove the fast reassemble / single widget reload feature (#132255)
Fixes https://github.com/flutter/flutter/issues/132157
This commit is contained in:
@@ -33,7 +33,7 @@ String getDefaultCachedKernelPath({
|
||||
}) {
|
||||
final StringBuffer buffer = StringBuffer();
|
||||
final List<String> cacheFrontEndOptions = extraFrontEndOptions.toList()
|
||||
..removeWhere((String arg) => arg.startsWith('--enable-experiment=') || arg == '--flutter-widget-cache');
|
||||
..removeWhere((String arg) => arg.startsWith('--enable-experiment='));
|
||||
buffer.writeAll(dartDefines);
|
||||
buffer.writeAll(cacheFrontEndOptions);
|
||||
String buildPrefix = '';
|
||||
|
||||
@@ -401,7 +401,6 @@ class UpdateFSReport {
|
||||
bool success = false,
|
||||
int invalidatedSourcesCount = 0,
|
||||
int syncedBytes = 0,
|
||||
this.fastReassembleClassName,
|
||||
int scannedSourcesCount = 0,
|
||||
Duration compileDuration = Duration.zero,
|
||||
Duration transferDuration = Duration.zero,
|
||||
@@ -423,7 +422,6 @@ class UpdateFSReport {
|
||||
Duration get findInvalidatedDuration => _findInvalidatedDuration;
|
||||
|
||||
bool _success;
|
||||
String? fastReassembleClassName;
|
||||
int _invalidatedSourcesCount;
|
||||
int _syncedBytes;
|
||||
int _scannedSourcesCount;
|
||||
@@ -435,7 +433,6 @@ class UpdateFSReport {
|
||||
if (!report._success) {
|
||||
_success = false;
|
||||
}
|
||||
fastReassembleClassName ??= report.fastReassembleClassName;
|
||||
_invalidatedSourcesCount += report._invalidatedSourcesCount;
|
||||
_syncedBytes += report._syncedBytes;
|
||||
_scannedSourcesCount += report._scannedSourcesCount;
|
||||
@@ -495,7 +492,6 @@ class DevFS {
|
||||
DateTime? lastCompiled;
|
||||
DateTime? _previousCompiled;
|
||||
PackageConfig? lastPackageConfig;
|
||||
File? _widgetCacheOutputFile;
|
||||
|
||||
Uri? _baseUri;
|
||||
Uri? get baseUri => _baseUri;
|
||||
@@ -555,22 +551,6 @@ class DevFS {
|
||||
lastCompiled = _previousCompiled;
|
||||
}
|
||||
|
||||
|
||||
/// If the build method of a single widget was modified, return the widget name.
|
||||
///
|
||||
/// If any other changes were made, or there is an error scanning the file,
|
||||
/// return `null`.
|
||||
String? _checkIfSingleWidgetReloadApplied() {
|
||||
final File? widgetCacheOutputFile = _widgetCacheOutputFile;
|
||||
if (widgetCacheOutputFile != null && widgetCacheOutputFile.existsSync()) {
|
||||
final String widget = widgetCacheOutputFile.readAsStringSync().trim();
|
||||
if (widget.isNotEmpty) {
|
||||
return widget;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Updates files on the device.
|
||||
///
|
||||
/// Returns the number of bytes synced.
|
||||
@@ -596,7 +576,6 @@ class DevFS {
|
||||
final DateTime candidateCompileTime = DateTime.now();
|
||||
didUpdateFontManifest = false;
|
||||
lastPackageConfig = packageConfig;
|
||||
_widgetCacheOutputFile = _fileSystem.file('$dillOutputPath.incremental.dill.widget_cache');
|
||||
|
||||
// Update modified files
|
||||
final Map<Uri, DevFSContent> dirtyEntries = <Uri, DevFSContent>{};
|
||||
@@ -741,7 +720,6 @@ class DevFS {
|
||||
success: true,
|
||||
syncedBytes: syncedBytes,
|
||||
invalidatedSourcesCount: invalidatedFiles.length,
|
||||
fastReassembleClassName: _checkIfSingleWidgetReloadApplied(),
|
||||
compileDuration: compileTimer.elapsed,
|
||||
transferDuration: transferTimer.elapsed,
|
||||
);
|
||||
|
||||
@@ -44,9 +44,6 @@ abstract class FeatureFlags {
|
||||
/// Whether custom devices are enabled.
|
||||
bool get areCustomDevicesEnabled => false;
|
||||
|
||||
/// Whether fast single widget reloads are enabled.
|
||||
bool get isSingleWidgetReloadEnabled => false;
|
||||
|
||||
/// Whether WebAssembly compilation for Flutter Web is enabled.
|
||||
bool get isFlutterWebWasmEnabled => false;
|
||||
|
||||
@@ -62,7 +59,6 @@ const List<Feature> allFeatures = <Feature>[
|
||||
flutterLinuxDesktopFeature,
|
||||
flutterMacOSDesktopFeature,
|
||||
flutterWindowsDesktopFeature,
|
||||
singleWidgetReload,
|
||||
flutterAndroidFeature,
|
||||
flutterIOSFeature,
|
||||
flutterFuchsiaFeature,
|
||||
@@ -140,20 +136,6 @@ const Feature flutterCustomDevicesFeature = Feature(
|
||||
),
|
||||
);
|
||||
|
||||
/// The fast hot reload feature for https://github.com/flutter/flutter/issues/61407.
|
||||
const Feature singleWidgetReload = Feature(
|
||||
name: 'Hot reload optimization for changes to class body of a single widget',
|
||||
configSetting: 'single-widget-reload-optimization',
|
||||
environmentOverride: 'FLUTTER_SINGLE_WIDGET_RELOAD',
|
||||
master: FeatureChannelSetting(
|
||||
available: true,
|
||||
enabledByDefault: true,
|
||||
),
|
||||
beta: FeatureChannelSetting(
|
||||
available: true,
|
||||
),
|
||||
);
|
||||
|
||||
/// Enabling WebAssembly compilation from `flutter build web`
|
||||
const Feature flutterWebWasm = Feature(
|
||||
name: 'WebAssembly compilation from flutter build web',
|
||||
|
||||
@@ -44,9 +44,6 @@ class FlutterFeatureFlags implements FeatureFlags {
|
||||
@override
|
||||
bool get areCustomDevicesEnabled => isEnabled(flutterCustomDevicesFeature);
|
||||
|
||||
@override
|
||||
bool get isSingleWidgetReloadEnabled => isEnabled(singleWidgetReload);
|
||||
|
||||
@override
|
||||
bool get isFlutterWebWasmEnabled => isEnabled(flutterWebWasm);
|
||||
|
||||
|
||||
@@ -446,7 +446,6 @@ Please provide a valid TCP port (an integer between 0 and 65535, inclusive).
|
||||
fullRestart: true,
|
||||
reason: reason,
|
||||
overallTimeInMs: elapsed.inMilliseconds,
|
||||
fastReassemble: false,
|
||||
).send();
|
||||
}
|
||||
return OperationResult.ok;
|
||||
|
||||
@@ -58,7 +58,6 @@ class CustomDimensions {
|
||||
this.commandRunAndroidEmbeddingVersion,
|
||||
this.commandPackagesAndroidEmbeddingVersion,
|
||||
this.nullSafety,
|
||||
this.fastReassemble,
|
||||
this.nullSafeMigratedLibraries,
|
||||
this.nullSafeTotalLibraries,
|
||||
this.hotEventCompileTimeInMs,
|
||||
@@ -118,17 +117,17 @@ class CustomDimensions {
|
||||
final String? commandRunAndroidEmbeddingVersion; // cd45
|
||||
final String? commandPackagesAndroidEmbeddingVersion; // cd46
|
||||
final bool? nullSafety; // cd47
|
||||
final bool? fastReassemble; // cd48
|
||||
// cd48 was fastReassemble but that feature was removed
|
||||
final int? nullSafeMigratedLibraries; // cd49
|
||||
final int? nullSafeTotalLibraries; // cd50
|
||||
final int? hotEventCompileTimeInMs; // cd 51
|
||||
final int? hotEventFindInvalidatedTimeInMs; // cd 52
|
||||
final int? hotEventScannedSourcesCount; // cd 53
|
||||
final int? hotEventReassembleTimeInMs; // cd 54
|
||||
final int? hotEventReloadVMTimeInMs; // cd 55
|
||||
final bool? commandRunEnableImpeller; // cd 56
|
||||
final String? commandRunIOSInterfaceType; // cd 57
|
||||
final bool? commandRunIsTest; // cd 58
|
||||
final int? hotEventCompileTimeInMs; // cd51
|
||||
final int? hotEventFindInvalidatedTimeInMs; // cd52
|
||||
final int? hotEventScannedSourcesCount; // cd53
|
||||
final int? hotEventReassembleTimeInMs; // cd54
|
||||
final int? hotEventReloadVMTimeInMs; // cd55
|
||||
final bool? commandRunEnableImpeller; // cd56
|
||||
final String? commandRunIOSInterfaceType; // cd57
|
||||
final bool? commandRunIsTest; // cd58
|
||||
|
||||
/// Convert to a map that will be used to upload to the analytics backend.
|
||||
Map<String, String> toMap() => <String, String>{
|
||||
@@ -179,7 +178,6 @@ class CustomDimensions {
|
||||
if (commandRunAndroidEmbeddingVersion != null) CustomDimensionsEnum.commandRunAndroidEmbeddingVersion.cdKey: commandRunAndroidEmbeddingVersion.toString(),
|
||||
if (commandPackagesAndroidEmbeddingVersion != null) CustomDimensionsEnum.commandPackagesAndroidEmbeddingVersion.cdKey: commandPackagesAndroidEmbeddingVersion.toString(),
|
||||
if (nullSafety != null) CustomDimensionsEnum.nullSafety.cdKey: nullSafety.toString(),
|
||||
if (fastReassemble != null) CustomDimensionsEnum.fastReassemble.cdKey: fastReassemble.toString(),
|
||||
if (nullSafeMigratedLibraries != null) CustomDimensionsEnum.nullSafeMigratedLibraries.cdKey: nullSafeMigratedLibraries.toString(),
|
||||
if (nullSafeTotalLibraries != null) CustomDimensionsEnum.nullSafeTotalLibraries.cdKey: nullSafeTotalLibraries.toString(),
|
||||
if (hotEventCompileTimeInMs != null) CustomDimensionsEnum.hotEventCompileTimeInMs.cdKey: hotEventCompileTimeInMs.toString(),
|
||||
@@ -247,7 +245,6 @@ class CustomDimensions {
|
||||
commandRunAndroidEmbeddingVersion: other.commandRunAndroidEmbeddingVersion ?? commandRunAndroidEmbeddingVersion,
|
||||
commandPackagesAndroidEmbeddingVersion: other.commandPackagesAndroidEmbeddingVersion ?? commandPackagesAndroidEmbeddingVersion,
|
||||
nullSafety: other.nullSafety ?? nullSafety,
|
||||
fastReassemble: other.fastReassemble ?? fastReassemble,
|
||||
nullSafeMigratedLibraries: other.nullSafeMigratedLibraries ?? nullSafeMigratedLibraries,
|
||||
nullSafeTotalLibraries: other.nullSafeTotalLibraries ?? nullSafeTotalLibraries,
|
||||
hotEventCompileTimeInMs: other.hotEventCompileTimeInMs ?? hotEventCompileTimeInMs,
|
||||
@@ -309,7 +306,6 @@ class CustomDimensions {
|
||||
commandRunAndroidEmbeddingVersion: _extractString(map, CustomDimensionsEnum.commandRunAndroidEmbeddingVersion),
|
||||
commandPackagesAndroidEmbeddingVersion: _extractString(map, CustomDimensionsEnum.commandPackagesAndroidEmbeddingVersion),
|
||||
nullSafety: _extractBool(map, CustomDimensionsEnum.nullSafety),
|
||||
fastReassemble: _extractBool(map, CustomDimensionsEnum.fastReassemble),
|
||||
nullSafeMigratedLibraries: _extractInt(map, CustomDimensionsEnum.nullSafeMigratedLibraries),
|
||||
nullSafeTotalLibraries: _extractInt(map, CustomDimensionsEnum.nullSafeTotalLibraries),
|
||||
hotEventCompileTimeInMs: _extractInt(map, CustomDimensionsEnum.hotEventCompileTimeInMs),
|
||||
@@ -397,7 +393,7 @@ enum CustomDimensionsEnum {
|
||||
commandRunAndroidEmbeddingVersion, // cd45
|
||||
commandPackagesAndroidEmbeddingVersion, // cd46
|
||||
nullSafety, // cd47
|
||||
fastReassemble, // cd48
|
||||
obsolete1, // cd48 (was fastReassemble)
|
||||
nullSafeMigratedLibraries, // cd49
|
||||
nullSafeTotalLibraries, // cd50
|
||||
hotEventCompileTimeInMs, // cd51
|
||||
|
||||
@@ -39,7 +39,6 @@ class HotEvent extends UsageEvent {
|
||||
required this.sdkName,
|
||||
required this.emulator,
|
||||
required this.fullRestart,
|
||||
required this.fastReassemble,
|
||||
this.reason,
|
||||
this.finalLibraryCount,
|
||||
this.syncedLibraryCount,
|
||||
@@ -63,7 +62,6 @@ class HotEvent extends UsageEvent {
|
||||
final String sdkName;
|
||||
final bool emulator;
|
||||
final bool fullRestart;
|
||||
final bool fastReassemble;
|
||||
final int? finalLibraryCount;
|
||||
final int? syncedLibraryCount;
|
||||
final int? syncedClassesCount;
|
||||
@@ -94,7 +92,6 @@ class HotEvent extends UsageEvent {
|
||||
hotEventInvalidatedSourcesCount: invalidatedSourcesCount,
|
||||
hotEventTransferTimeInMs: transferTimeInMs,
|
||||
hotEventOverallTimeInMs: overallTimeInMs,
|
||||
fastReassemble: fastReassemble,
|
||||
hotEventCompileTimeInMs: compileTimeInMs,
|
||||
hotEventFindInvalidatedTimeInMs: findInvalidatedTimeInMs,
|
||||
hotEventScannedSourcesCount: scannedSourcesCount,
|
||||
|
||||
@@ -34,7 +34,6 @@ import 'compile.dart';
|
||||
import 'convert.dart';
|
||||
import 'devfs.dart';
|
||||
import 'device.dart';
|
||||
import 'features.dart';
|
||||
import 'globals.dart' as globals;
|
||||
import 'ios/application_package.dart';
|
||||
import 'ios/devices.dart';
|
||||
@@ -169,11 +168,8 @@ class FlutterDevice {
|
||||
platform: platform,
|
||||
);
|
||||
} else {
|
||||
// The flutter-widget-cache feature only applies to run mode.
|
||||
List<String> extraFrontEndOptions = buildInfo.extraFrontEndOptions;
|
||||
extraFrontEndOptions = <String>[
|
||||
if (featureFlags.isSingleWidgetReloadEnabled)
|
||||
'--flutter-widget-cache',
|
||||
'--enable-experiment=alternative-invalidation-strategy',
|
||||
...extraFrontEndOptions,
|
||||
];
|
||||
|
||||
@@ -20,7 +20,6 @@ import 'convert.dart';
|
||||
import 'dart/package_map.dart';
|
||||
import 'devfs.dart';
|
||||
import 'device.dart';
|
||||
import 'features.dart';
|
||||
import 'globals.dart' as globals;
|
||||
import 'project.dart';
|
||||
import 'reporting/reporting.dart';
|
||||
@@ -415,7 +414,6 @@ class HotRunner extends ResidentRunner {
|
||||
sdkName: _sdkName!,
|
||||
emulator: _emulator!,
|
||||
fullRestart: false,
|
||||
fastReassemble: false,
|
||||
overallTimeInMs: appStartedTimer.elapsed.inMilliseconds,
|
||||
compileTimeInMs: totalCompileTime.inMilliseconds,
|
||||
transferTimeInMs: totalLaunchAppTime.inMilliseconds,
|
||||
@@ -802,7 +800,6 @@ class HotRunner extends ResidentRunner {
|
||||
emulator: emulator!,
|
||||
fullRestart: true,
|
||||
reason: reason,
|
||||
fastReassemble: false,
|
||||
overallTimeInMs: restartTimer.elapsed.inMilliseconds,
|
||||
syncedBytes: result.updateFSReport?.syncedBytes,
|
||||
invalidatedSourcesCount: result.updateFSReport?.invalidatedSourcesCount,
|
||||
@@ -828,7 +825,6 @@ class HotRunner extends ResidentRunner {
|
||||
emulator: emulator!,
|
||||
fullRestart: true,
|
||||
reason: reason,
|
||||
fastReassemble: false,
|
||||
).send();
|
||||
}
|
||||
status?.cancel();
|
||||
@@ -878,7 +874,6 @@ class HotRunner extends ResidentRunner {
|
||||
emulator: emulator!,
|
||||
fullRestart: false,
|
||||
reason: reason,
|
||||
fastReassemble: false,
|
||||
).send();
|
||||
} else {
|
||||
HotEvent('exception',
|
||||
@@ -887,7 +882,6 @@ class HotRunner extends ResidentRunner {
|
||||
emulator: emulator!,
|
||||
fullRestart: false,
|
||||
reason: reason,
|
||||
fastReassemble: false,
|
||||
).send();
|
||||
}
|
||||
return OperationResult(errorCode, errorMessage, fatal: true);
|
||||
@@ -971,7 +965,6 @@ class HotRunner extends ResidentRunner {
|
||||
viewCache,
|
||||
onSlow,
|
||||
reloadMessage,
|
||||
updatedDevFS.fastReassembleClassName,
|
||||
);
|
||||
shouldReportReloadTime = reassembleResult.shouldReportReloadTime;
|
||||
if (reassembleResult.reassembleViews.isEmpty) {
|
||||
@@ -1005,7 +998,6 @@ class HotRunner extends ResidentRunner {
|
||||
syncedBytes: updatedDevFS.syncedBytes,
|
||||
invalidatedSourcesCount: updatedDevFS.invalidatedSourcesCount,
|
||||
transferTimeInMs: updatedDevFS.transferDuration.inMilliseconds,
|
||||
fastReassemble: featureFlags.isSingleWidgetReloadEnabled && updatedDevFS.fastReassembleClassName != null,
|
||||
compileTimeInMs: updatedDevFS.compileDuration.inMilliseconds,
|
||||
findInvalidatedTimeInMs: updatedDevFS.findInvalidatedDuration.inMilliseconds,
|
||||
scannedSourcesCount: updatedDevFS.scannedSourcesCount,
|
||||
@@ -1225,7 +1217,6 @@ Future<OperationResult> defaultReloadSourcesHelper(
|
||||
emulator: emulator!,
|
||||
fullRestart: false,
|
||||
reason: reason,
|
||||
fastReassemble: false,
|
||||
usage: usage,
|
||||
).send();
|
||||
// Reset devFS lastCompileTime to ensure the file will still be marked
|
||||
@@ -1288,7 +1279,6 @@ typedef ReassembleHelper = Future<ReassembleResult> Function(
|
||||
Map<FlutterDevice?, List<FlutterView>> viewCache,
|
||||
void Function(String message)? onSlow,
|
||||
String reloadMessage,
|
||||
String? fastReassembleClassName,
|
||||
);
|
||||
|
||||
Future<ReassembleResult> _defaultReassembleHelper(
|
||||
@@ -1296,7 +1286,6 @@ Future<ReassembleResult> _defaultReassembleHelper(
|
||||
Map<FlutterDevice?, List<FlutterView>> viewCache,
|
||||
void Function(String message)? onSlow,
|
||||
String reloadMessage,
|
||||
String? fastReassembleClassName,
|
||||
) async {
|
||||
// Check if any isolates are paused and reassemble those that aren't.
|
||||
final Map<FlutterView, FlutterVmService?> reassembleViews = <FlutterView, FlutterVmService?>{};
|
||||
@@ -1325,17 +1314,9 @@ Future<ReassembleResult> _defaultReassembleHelper(
|
||||
reassembleViews[view] = device.vmService;
|
||||
// If the tool identified a change in a single widget, do a fast instead
|
||||
// of a full reassemble.
|
||||
Future<void> reassembleWork;
|
||||
if (fastReassembleClassName != null) {
|
||||
reassembleWork = device.vmService!.flutterFastReassemble(
|
||||
isolateId: view.uiIsolate!.id!,
|
||||
className: fastReassembleClassName,
|
||||
);
|
||||
} else {
|
||||
reassembleWork = device.vmService!.flutterReassemble(
|
||||
isolateId: view.uiIsolate!.id!,
|
||||
);
|
||||
}
|
||||
final Future<void> reassembleWork = device.vmService!.flutterReassemble(
|
||||
isolateId: view.uiIsolate!.id!,
|
||||
);
|
||||
reassembleFutures.add(reassembleWork.then(
|
||||
(Object? obj) => obj,
|
||||
onError: (Object error, StackTrace stackTrace) {
|
||||
|
||||
@@ -809,19 +809,6 @@ class FlutterVmService {
|
||||
);
|
||||
}
|
||||
|
||||
Future<Map<String, Object?>?> flutterFastReassemble({
|
||||
required String isolateId,
|
||||
required String className,
|
||||
}) {
|
||||
return invokeFlutterExtensionRpcRaw(
|
||||
'ext.flutter.fastReassemble',
|
||||
isolateId: isolateId,
|
||||
args: <String, Object>{
|
||||
'className': className,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<bool> flutterAlreadyPaintedFirstUsefulFrame({
|
||||
required String isolateId,
|
||||
}) async {
|
||||
|
||||
Reference in New Issue
Block a user