Skip to content

Commit 0521c60

Browse files
authored
Support --local-engine=ios_debug_sim (#119524)
Fixes: * flutter/flutter#119523
1 parent 5e506ae commit 0521c60

File tree

2 files changed

+57
-2
lines changed

2 files changed

+57
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class LocalEngineLocator {
157157
}
158158

159159
// Determine the host engine directory associated with the local engine:
160-
// Strip '_sim_' since there are no host simulator builds.
160+
// Strip '_sim' since there are no host simulator builds.
161161
String _getHostEngineBasename(String localEngineBasename) {
162162
if (localEngineBasename.startsWith('web_') ||
163163
localEngineBasename.startsWith('wasm_') ||
@@ -166,7 +166,7 @@ class LocalEngineLocator {
166166
return localEngineBasename;
167167
}
168168

169-
String tmpBasename = localEngineBasename.replaceFirst('_sim_', '_');
169+
String tmpBasename = localEngineBasename.replaceFirst('_sim', '');
170170
tmpBasename = tmpBasename.substring(tmpBasename.indexOf('_') + 1);
171171
// Strip suffix for various archs.
172172
const List<String> suffixes = <String>['_arm', '_arm64', '_x86', '_x64'];

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

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,61 @@ void main() {
170170
);
171171
});
172172

173+
testWithoutContext('works if local engine is simulator', () async {
174+
final FileSystem fileSystem = MemoryFileSystem.test();
175+
final Directory localEngine = fileSystem
176+
.directory('$kArbitraryEngineRoot/src/out/ios_debug_sim/')
177+
..createSync(recursive: true);
178+
fileSystem
179+
.directory('$kArbitraryEngineRoot/src/out/host_debug/')
180+
.createSync(recursive: true);
181+
182+
final BufferLogger logger = BufferLogger.test();
183+
final LocalEngineLocator localEngineLocator = LocalEngineLocator(
184+
fileSystem: fileSystem,
185+
flutterRoot: 'flutter/flutter',
186+
logger: logger,
187+
userMessages: UserMessages(),
188+
platform: FakePlatform(environment: <String, String>{}),
189+
);
190+
191+
expect(
192+
await localEngineLocator.findEnginePath(localEngine: localEngine.path),
193+
matchesEngineBuildPaths(
194+
hostEngine: '/arbitrary/engine/src/out/host_debug',
195+
targetEngine: '/arbitrary/engine/src/out/ios_debug_sim',
196+
),
197+
);
198+
});
199+
200+
testWithoutContext('works if local engine is simulator unoptimized',
201+
() async {
202+
final FileSystem fileSystem = MemoryFileSystem.test();
203+
final Directory localEngine = fileSystem
204+
.directory('$kArbitraryEngineRoot/src/out/ios_debug_sim_unopt/')
205+
..createSync(recursive: true);
206+
fileSystem
207+
.directory('$kArbitraryEngineRoot/src/out/host_debug_unopt/')
208+
.createSync(recursive: true);
209+
210+
final BufferLogger logger = BufferLogger.test();
211+
final LocalEngineLocator localEngineLocator = LocalEngineLocator(
212+
fileSystem: fileSystem,
213+
flutterRoot: 'flutter/flutter',
214+
logger: logger,
215+
userMessages: UserMessages(),
216+
platform: FakePlatform(environment: <String, String>{}),
217+
);
218+
219+
expect(
220+
await localEngineLocator.findEnginePath(localEngine: localEngine.path),
221+
matchesEngineBuildPaths(
222+
hostEngine: '/arbitrary/engine/src/out/host_debug_unopt',
223+
targetEngine: '/arbitrary/engine/src/out/ios_debug_sim_unopt',
224+
),
225+
);
226+
});
227+
173228
testWithoutContext('fails if host_debug does not exist', () async {
174229
final FileSystem fileSystem = MemoryFileSystem.test();
175230
final Directory localEngine = fileSystem

0 commit comments

Comments
 (0)