Prevent flutter build ios-framework --xcframework from copying Flutter.xcframework.dSYM into the App.framework folder. (#157394)

Fixes https://github.com/flutter/flutter/issues/157359

Prevents Flutter.xcframework.dSYM from being copied into the App.framework folder. I am not 100% positive if there are cases where it's valid to have multiple dSYMs in that folder, so I'm just string matching and filtering out `Flutter.xcframework.dSYM`
This commit is contained in:
LouiseHsu 2024-10-23 16:35:10 -07:00 committed by GitHub
parent dad3fea650
commit bade5591bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 7 deletions

View File

@ -188,15 +188,25 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
'vm_snapshot_data',
));
final String dsymPath = path.join(
outputPath,
mode,
'App.xcframework',
'ios-arm64',
'dSYMs'
);
checkDirectoryExists(dsymPath);
final String appFrameworkDsymPath = path.join(
outputPath,
mode,
'App.xcframework',
'ios-arm64',
'dSYMs',
'App.framework.dSYM'
dsymPath,
'App.framework.dSYM'
);
checkDirectoryExists(appFrameworkDsymPath);
if (Directory(dsymPath).listSync().whereType<Directory>().length != 1) {
throw TaskResult.failure('App.framework/dSYMs should ONLY contain App.xcframework.dSYM');
}
await _checkDsym(path.join(
appFrameworkDsymPath,
'Contents',

View File

@ -150,7 +150,7 @@ abstract class BuildFrameworkCommand extends BuildSubCommand {
...framework.parent
.listSync()
.where((FileSystemEntity entity) =>
entity.basename.endsWith('dSYM'))
entity.basename.endsWith('dSYM') && !entity.basename.startsWith('Flutter'))
.map((FileSystemEntity entity) => <String>['-debug-symbols', entity.path])
.expand<String>((List<String> parameter) => parameter),
],

View File

@ -558,6 +558,8 @@ void main() {
final Directory parentA = fileSystem.directory('FrameworkA')..createSync();
final File dSYMA = parentA.childFile('FrameworkA.framework.dSYM')..createSync();
final Directory frameworkA = parentA.childDirectory('FrameworkA.framework')..createSync();
// Flutter.framework.dSYM should be correctly filtered out.
parentA.childFile('Flutter.framework.dSYM').createSync();
final Directory parentB = fileSystem.directory('FrameworkB')..createSync();
final File dSYMB = parentB.childFile('FrameworkB.framework.dSYM')..createSync();