Skip to content

Commit 2e51077

Browse files
authored
Do not strip architecture suffixes from host local-engine (#115320)
* Do not strip suffices from host local-engine * suffixes
1 parent a0a7b3a commit 2e51077

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

packages/flutter_tools/lib/src/runner/local_engine.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,10 @@ class LocalEngineLocator {
150150
// Determine the host engine directory associated with the local engine:
151151
// Strip '_sim_' since there are no host simulator builds.
152152
String _getHostEngineBasename(String localEngineBasename) {
153-
if (localEngineBasename.startsWith('web_') || localEngineBasename.startsWith('wasm_')) {
154-
// Don't modify the web local engine's basename.
153+
if (localEngineBasename.startsWith('web_') ||
154+
localEngineBasename.startsWith('wasm_') ||
155+
localEngineBasename.startsWith('host_')) {
156+
// Don't modify the web or host local engine's basename.
155157
return localEngineBasename;
156158
}
157159

packages/flutter_tools/test/general.shard/runner/local_engine_test.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,30 @@ void main() {
146146
expect(logger.traceText, contains('Local engine source at /arbitrary/engine/src'));
147147
});
148148

149+
testWithoutContext('works if local engine is host engine with suffixes', () async {
150+
final FileSystem fileSystem = MemoryFileSystem.test();
151+
final Directory localEngine = fileSystem
152+
.directory('$kArbitraryEngineRoot/src/out/host_debug_unopt_arm64/')
153+
..createSync(recursive: true);
154+
155+
final BufferLogger logger = BufferLogger.test();
156+
final LocalEngineLocator localEngineLocator = LocalEngineLocator(
157+
fileSystem: fileSystem,
158+
flutterRoot: 'flutter/flutter',
159+
logger: logger,
160+
userMessages: UserMessages(),
161+
platform: FakePlatform(environment: <String, String>{}),
162+
);
163+
164+
expect(
165+
await localEngineLocator.findEnginePath(null, localEngine.path, null),
166+
matchesEngineBuildPaths(
167+
hostEngine: '/arbitrary/engine/src/out/host_debug_unopt_arm64',
168+
targetEngine: '/arbitrary/engine/src/out/host_debug_unopt_arm64',
169+
),
170+
);
171+
});
172+
149173
testWithoutContext('fails if host_debug does not exist', () async {
150174
final FileSystem fileSystem = MemoryFileSystem.test();
151175
final Directory localEngine = fileSystem

0 commit comments

Comments
 (0)