Skip to content

Commit

Permalink
Fix et run (#52477)
Browse files Browse the repository at this point in the history
et run was broken in #51803

this PR adds the missing calls to mangledConfigName before invoking flutter run
  • Loading branch information
johnmccutchan authored May 1, 2024
1 parent dbe6a92 commit 0014e03
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
40 changes: 26 additions & 14 deletions tools/engine_tool/lib/src/commands/run_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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) {
Expand All @@ -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')) {
Expand Down Expand Up @@ -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<String> command = <String>[
'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(
<String>[
'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,
);
Expand Down
4 changes: 2 additions & 2 deletions tools/engine_tool/test/run_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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'
]));
Expand Down

0 comments on commit 0014e03

Please sign in to comment.