Support --local-engine=ios_debug_sim (#119524)
Fixes: * https://github.com/flutter/flutter/issues/119523
This commit is contained in:
@@ -157,7 +157,7 @@ class LocalEngineLocator {
|
||||
}
|
||||
|
||||
// Determine the host engine directory associated with the local engine:
|
||||
// Strip '_sim_' since there are no host simulator builds.
|
||||
// Strip '_sim' since there are no host simulator builds.
|
||||
String _getHostEngineBasename(String localEngineBasename) {
|
||||
if (localEngineBasename.startsWith('web_') ||
|
||||
localEngineBasename.startsWith('wasm_') ||
|
||||
@@ -166,7 +166,7 @@ class LocalEngineLocator {
|
||||
return localEngineBasename;
|
||||
}
|
||||
|
||||
String tmpBasename = localEngineBasename.replaceFirst('_sim_', '_');
|
||||
String tmpBasename = localEngineBasename.replaceFirst('_sim', '');
|
||||
tmpBasename = tmpBasename.substring(tmpBasename.indexOf('_') + 1);
|
||||
// Strip suffix for various archs.
|
||||
const List<String> suffixes = <String>['_arm', '_arm64', '_x86', '_x64'];
|
||||
|
||||
@@ -170,6 +170,61 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('works if local engine is simulator', () async {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final Directory localEngine = fileSystem
|
||||
.directory('$kArbitraryEngineRoot/src/out/ios_debug_sim/')
|
||||
..createSync(recursive: true);
|
||||
fileSystem
|
||||
.directory('$kArbitraryEngineRoot/src/out/host_debug/')
|
||||
.createSync(recursive: true);
|
||||
|
||||
final BufferLogger logger = BufferLogger.test();
|
||||
final LocalEngineLocator localEngineLocator = LocalEngineLocator(
|
||||
fileSystem: fileSystem,
|
||||
flutterRoot: 'flutter/flutter',
|
||||
logger: logger,
|
||||
userMessages: UserMessages(),
|
||||
platform: FakePlatform(environment: <String, String>{}),
|
||||
);
|
||||
|
||||
expect(
|
||||
await localEngineLocator.findEnginePath(localEngine: localEngine.path),
|
||||
matchesEngineBuildPaths(
|
||||
hostEngine: '/arbitrary/engine/src/out/host_debug',
|
||||
targetEngine: '/arbitrary/engine/src/out/ios_debug_sim',
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('works if local engine is simulator unoptimized',
|
||||
() async {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final Directory localEngine = fileSystem
|
||||
.directory('$kArbitraryEngineRoot/src/out/ios_debug_sim_unopt/')
|
||||
..createSync(recursive: true);
|
||||
fileSystem
|
||||
.directory('$kArbitraryEngineRoot/src/out/host_debug_unopt/')
|
||||
.createSync(recursive: true);
|
||||
|
||||
final BufferLogger logger = BufferLogger.test();
|
||||
final LocalEngineLocator localEngineLocator = LocalEngineLocator(
|
||||
fileSystem: fileSystem,
|
||||
flutterRoot: 'flutter/flutter',
|
||||
logger: logger,
|
||||
userMessages: UserMessages(),
|
||||
platform: FakePlatform(environment: <String, String>{}),
|
||||
);
|
||||
|
||||
expect(
|
||||
await localEngineLocator.findEnginePath(localEngine: localEngine.path),
|
||||
matchesEngineBuildPaths(
|
||||
hostEngine: '/arbitrary/engine/src/out/host_debug_unopt',
|
||||
targetEngine: '/arbitrary/engine/src/out/ios_debug_sim_unopt',
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('fails if host_debug does not exist', () async {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final Directory localEngine = fileSystem
|
||||
|
||||
Reference in New Issue
Block a user