From 0014e0353aa9b2947ff38cc9c9aad8741e5999f7 Mon Sep 17 00:00:00 2001 From: John McCutchan Date: Wed, 1 May 2024 07:20:04 -0700 Subject: [PATCH] Fix et run (#52477) et run was broken in https://github.com/flutter/engine/pull/51803 this PR adds the missing calls to mangledConfigName before invoking flutter run --- .../lib/src/commands/run_command.dart | 40 ++++++++++++------- tools/engine_tool/test/run_command_test.dart | 4 +- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/tools/engine_tool/lib/src/commands/run_command.dart b/tools/engine_tool/lib/src/commands/run_command.dart index 5bae90a3b3516..c0187b0e0f1fd 100644 --- a/tools/engine_tool/lib/src/commands/run_command.dart +++ b/tools/engine_tool/lib/src/commands/run_command.dart @@ -30,7 +30,9 @@ final class RunCommand extends CommandBase { // We default to nothing in order to automatically detect attached devices // and select an appropriate target from them. addConfigOption( - environment, argParser, builds, + environment, + argParser, + builds, defaultsTo: '', ); argParser.addFlag( @@ -58,7 +60,9 @@ See `flutter run --help` for a listing Build? _lookup(String configName) { final String demangledName = demangleConfigName(environment, configName); - return builds.where((Build build) => build.name == demangledName).firstOrNull; + return builds + .where((Build build) => build.name == demangledName) + .firstOrNull; } Build? _findHostBuild(Build? targetBuild) { @@ -71,7 +75,8 @@ See `flutter run --help` for a listing } // TODO(johnmccutchan): This is brittle, it would be better if we encoded // the host config name in the target config. - final String ci = mangledName.startsWith('ci') ? mangledName.substring(0, 3) : ''; + final String ci = + mangledName.startsWith('ci') ? mangledName.substring(0, 3) : ''; if (mangledName.contains('_debug')) { return _lookup('${ci}host_debug'); } else if (mangledName.contains('_profile')) { @@ -166,21 +171,28 @@ See `flutter run --help` for a listing } } + final String mangledBuildName = mangleConfigName(environment, build.name); + + final String mangledHostBuildName = + mangleConfigName(environment, hostBuild.name); + + final List command = [ + 'flutter', + 'run', + '--local-engine-src-path', + environment.engine.srcDir.path, + '--local-engine', + mangledBuildName, + '--local-engine-host', + mangledHostBuildName, + ...argResults!.rest + ]; + // TODO(johnmccutchan): Be smart and if the user requested a profile // config, add the '--profile' flag when invoking flutter run. final ProcessRunnerResult result = await environment.processRunner.runProcess( - [ - 'flutter', - 'run', - '--local-engine-src-path', - environment.engine.srcDir.path, - '--local-engine', - build.name, - '--local-engine-host', - hostBuild.name, - ...argResults!.rest, - ], + command, runInShell: true, startMode: ProcessStartMode.inheritStdio, ); diff --git a/tools/engine_tool/test/run_command_test.dart b/tools/engine_tool/test/run_command_test.dart index 982ddedf48ba8..0e6de3dfa8354 100644 --- a/tools/engine_tool/test/run_command_test.dart +++ b/tools/engine_tool/test/run_command_test.dart @@ -153,9 +153,9 @@ void main() { 'flutter', 'run', '--local-engine', - 'linux/android_debug_arm64', + 'android_debug_arm64', '--local-engine-host', - 'linux/host_debug', + 'host_debug', '-d', 'emulator' ]));