Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Fix et run #52477

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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