Remove Finder extended attributes before code signing iOS frameworks (#81342)
This commit is contained in:
@@ -626,7 +626,20 @@ void _signFramework(Environment environment, String binaryPath, BuildMode buildM
|
||||
if (codesignIdentity == null || codesignIdentity.isEmpty) {
|
||||
return;
|
||||
}
|
||||
final ProcessResult result = environment.processManager.runSync(<String>[
|
||||
|
||||
// Extended attributes applied by Finder can cause code signing errors. Remove them.
|
||||
// https://developer.apple.com/library/archive/qa/qa1940/_index.html
|
||||
final ProcessResult xattrResult = environment.processManager.runSync(<String>[
|
||||
'xattr',
|
||||
'-r',
|
||||
'-d',
|
||||
'com.apple.FinderInfo',
|
||||
binaryPath,
|
||||
]);
|
||||
if (xattrResult.exitCode != 0) {
|
||||
environment.logger.printTrace('Failed to remove FinderInfo extended attributes from $binaryPath.\n${xattrResult.stderr}');
|
||||
}
|
||||
final ProcessResult codesignResult = environment.processManager.runSync(<String>[
|
||||
'codesign',
|
||||
'--force',
|
||||
'--sign',
|
||||
@@ -637,7 +650,7 @@ void _signFramework(Environment environment, String binaryPath, BuildMode buildM
|
||||
],
|
||||
binaryPath,
|
||||
]);
|
||||
if (result.exitCode != 0) {
|
||||
throw Exception('Failed to codesign $binaryPath with identity $codesignIdentity.\n${result.stderr}');
|
||||
if (codesignResult.exitCode != 0) {
|
||||
throw Exception('Failed to codesign $binaryPath with identity $codesignIdentity.\n${codesignResult.stderr}');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user