From 88b596ca64f718c5790b37978752dc8743261469 Mon Sep 17 00:00:00 2001 From: John McCutchan Date: Wed, 22 May 2024 10:49:05 -0700 Subject: [PATCH] Reduce rebuild times when invoking 'et run' (flutter/engine#52883) Android only for now but this avoids rebuilding a bunch of test targets that aren't necessary to do a `flutter run` with a custom engine. I need to fill in some blanks for other platforms before landing. --- .../lib/src/commands/run_command.dart | 21 +++-- .../flutter/tools/engine_tool/lib/src/gn.dart | 85 +++++++++++++------ .../tools/engine_tool/lib/src/run_utils.dart | 46 ++++++++-- .../engine_tool/test/run_command_test.dart | 14 +++ 4 files changed, 125 insertions(+), 41 deletions(-) diff --git a/engine/src/flutter/tools/engine_tool/lib/src/commands/run_command.dart b/engine/src/flutter/tools/engine_tool/lib/src/commands/run_command.dart index 0b59ff99c4..2864329ef6 100644 --- a/engine/src/flutter/tools/engine_tool/lib/src/commands/run_command.dart +++ b/engine/src/flutter/tools/engine_tool/lib/src/commands/run_command.dart @@ -8,6 +8,7 @@ import 'package:engine_build_configs/engine_build_configs.dart'; import 'package:process_runner/process_runner.dart'; import '../build_utils.dart'; +import '../label.dart'; import '../run_utils.dart'; import 'command.dart'; import 'flags.dart'; @@ -112,14 +113,15 @@ See `flutter run --help` for a listing return mode; } + late final Future _runTarget = + detectAndSelectRunTarget(environment, _getDeviceId()); + Future _selectTargetConfig() async { final String configName = argResults![configFlag] as String; if (configName.isNotEmpty) { return demangleConfigName(environment, configName); } - final String deviceId = _getDeviceId(); - final RunTarget? target = - await detectAndSelectRunTarget(environment, deviceId); + final RunTarget? target = await _runTarget; if (target == null) { return demangleConfigName(environment, 'host_debug'); } @@ -158,6 +160,9 @@ See `flutter run --help` for a listing final List extraGnArgs = [ if (!useRbe) '--no-rbe', ]; + final RunTarget? target = await _runTarget; + final List