Remove Finder extended attributes from iOS project files (#54488)
This commit is contained in:
@@ -105,6 +105,8 @@ Future<XcodeBuildResult> buildXcodeProject({
|
||||
return XcodeBuildResult(success: false);
|
||||
}
|
||||
|
||||
await removeFinderExtendedAttributes(app.project.hostAppRoot, processUtils, globals.logger);
|
||||
|
||||
final XcodeProjectInfo projectInfo = await globals.xcodeProjectInterpreter.getInfo(app.project.hostAppRoot.path);
|
||||
if (!projectInfo.targets.contains('Runner')) {
|
||||
globals.printError('The Xcode project does not define target "Runner" which is needed by Flutter tooling.');
|
||||
@@ -405,6 +407,25 @@ Future<XcodeBuildResult> buildXcodeProject({
|
||||
}
|
||||
}
|
||||
|
||||
/// Extended attributes applied by Finder can cause code signing errors. Remove them.
|
||||
/// https://developer.apple.com/library/archive/qa/qa1940/_index.html
|
||||
@visibleForTesting
|
||||
Future<void> removeFinderExtendedAttributes(Directory iosProjectDirectory, ProcessUtils processUtils, Logger logger) async {
|
||||
final bool success = await processUtils.exitsHappy(
|
||||
<String>[
|
||||
'xattr',
|
||||
'-r',
|
||||
'-d',
|
||||
'com.apple.FinderInfo',
|
||||
iosProjectDirectory.path,
|
||||
]
|
||||
);
|
||||
// Ignore all errors, for example if directory is missing.
|
||||
if (!success) {
|
||||
logger.printTrace('Failed to remove xattr com.apple.FinderInfo from ${iosProjectDirectory.path}');
|
||||
}
|
||||
}
|
||||
|
||||
Future<RunResult> _runBuildWithRetries(List<String> buildCommands, BuildableIOSApp app) async {
|
||||
int buildRetryDelaySeconds = 1;
|
||||
int remainingTries = 8;
|
||||
|
||||
Reference in New Issue
Block a user