forked from firka/flutter
Don't generate plugin registry in ResidentWebRunner (#91281)
* Don't generate plugin registry in ResidentWebRunner generateDartPluginRegistry was being set to true unconditionally in ResidentRunner, bypassing the primary check in DartPluginRegistrantTarget, and the targetPlatform was not set in that codepath, bypassing the second after the changes in https://github.com/flutter/flutter/pull/87991. This caused web hot restarts to be slower due to doing unnecessary work. This ensures that generateDartPluginRegistry is false in the ResidentWebRunner to skip that unnecessary step. Fixes https://github.com/flutter/flutter/issues/91262 * Formatting Co-authored-by: Zachary Anderson <zanderso@users.noreply.github.com> Co-authored-by: Zachary Anderson <zanderso@users.noreply.github.com>
This commit is contained in:
@@ -66,6 +66,8 @@ class DartPluginRegistrantTarget extends Target {
|
||||
// TODO(stuartmorgan): Investigate removing this check entirely; ideally the
|
||||
// source generation step shouldn't be platform dependent, and the generated
|
||||
// code should just do the right thing on every platform.
|
||||
// Failing that, consider throwing if `targetPlatform` isn't set and finding
|
||||
// all violations, as it's not consistently set here.
|
||||
return targetPlatform == TargetPlatform.fuchsia_arm64 ||
|
||||
targetPlatform == TargetPlatform.fuchsia_x64 ||
|
||||
targetPlatform == TargetPlatform.web_javascript;
|
||||
|
||||
@@ -145,6 +145,10 @@ class ResidentWebRunner extends ResidentRunner {
|
||||
@override
|
||||
bool get supportsWriteSkSL => false;
|
||||
|
||||
@override
|
||||
// Web uses a different plugin registry.
|
||||
bool get generateDartPluginRegistry => false;
|
||||
|
||||
bool get _enableDwds => debuggingEnabled;
|
||||
|
||||
ConnectionResult _connectionResult;
|
||||
|
||||
@@ -1101,6 +1101,10 @@ abstract class ResidentRunner extends ResidentHandlers {
|
||||
|
||||
bool get trackWidgetCreation => debuggingOptions.buildInfo.trackWidgetCreation;
|
||||
|
||||
/// True if the shared Dart plugin registry (which is different than the one
|
||||
/// used for web) should be generated during source generation.
|
||||
bool get generateDartPluginRegistry => true;
|
||||
|
||||
// Returns the Uri of the first connected device for mobile,
|
||||
// and only connected device for web.
|
||||
//
|
||||
@@ -1152,7 +1156,7 @@ abstract class ResidentRunner extends ResidentHandlers {
|
||||
processManager: globals.processManager,
|
||||
platform: globals.platform,
|
||||
projectDir: globals.fs.currentDirectory,
|
||||
generateDartPluginRegistry: true,
|
||||
generateDartPluginRegistry: generateDartPluginRegistry,
|
||||
);
|
||||
|
||||
final CompositeTarget compositeTarget = CompositeTarget(<Target>[
|
||||
|
||||
Reference in New Issue
Block a user