forked from firka/flutter
Remove Finder extended attributes before code signing iOS frameworks (#81342)
This commit is contained in:
@@ -138,7 +138,14 @@ void main() {
|
||||
|
||||
final Directory frameworkDirectory = environment.outputDir.childDirectory('App.framework');
|
||||
final File frameworkDirectoryBinary = frameworkDirectory.childFile('App');
|
||||
processManager.addCommand(
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
FakeCommand(command: <String>[
|
||||
'xattr',
|
||||
'-r',
|
||||
'-d',
|
||||
'com.apple.FinderInfo',
|
||||
frameworkDirectoryBinary.path,
|
||||
]),
|
||||
FakeCommand(command: <String>[
|
||||
'codesign',
|
||||
'--force',
|
||||
@@ -147,7 +154,7 @@ void main() {
|
||||
'--timestamp=none',
|
||||
frameworkDirectoryBinary.path,
|
||||
]),
|
||||
);
|
||||
]);
|
||||
|
||||
await const DebugIosApplicationBundle().build(environment);
|
||||
expect(processManager.hasRemainingExpectations, isFalse);
|
||||
@@ -184,7 +191,14 @@ void main() {
|
||||
|
||||
final Directory frameworkDirectory = environment.outputDir.childDirectory('App.framework');
|
||||
final File frameworkDirectoryBinary = frameworkDirectory.childFile('App');
|
||||
processManager.addCommand(
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
FakeCommand(command: <String>[
|
||||
'xattr',
|
||||
'-r',
|
||||
'-d',
|
||||
'com.apple.FinderInfo',
|
||||
frameworkDirectoryBinary.path,
|
||||
]),
|
||||
FakeCommand(command: <String>[
|
||||
'codesign',
|
||||
'--force',
|
||||
@@ -192,7 +206,7 @@ void main() {
|
||||
'ABC123',
|
||||
frameworkDirectoryBinary.path,
|
||||
]),
|
||||
);
|
||||
]);
|
||||
|
||||
await const ReleaseIosApplicationBundle().build(environment);
|
||||
expect(processManager.hasRemainingExpectations, isFalse);
|
||||
@@ -277,6 +291,7 @@ void main() {
|
||||
FakeCommand lipoCommandNonFatResult;
|
||||
FakeCommand lipoVerifyArm64Command;
|
||||
FakeCommand bitcodeStripCommand;
|
||||
FakeCommand xattrRemoveCommand;
|
||||
|
||||
setUp(() {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
@@ -313,6 +328,14 @@ void main() {
|
||||
'-o',
|
||||
binary.path,
|
||||
]);
|
||||
|
||||
xattrRemoveCommand = FakeCommand(command: <String>[
|
||||
'xattr',
|
||||
'-r',
|
||||
'-d',
|
||||
'com.apple.FinderInfo',
|
||||
binary.path,
|
||||
]);
|
||||
});
|
||||
|
||||
testWithoutContext('iphonesimulator', () async {
|
||||
@@ -621,6 +644,54 @@ void main() {
|
||||
expect(processManager.hasRemainingExpectations, isFalse);
|
||||
});
|
||||
|
||||
testWithoutContext('logs when extended attribute fails', () async {
|
||||
binary.createSync(recursive: true);
|
||||
|
||||
final Environment environment = Environment.test(
|
||||
fileSystem.currentDirectory,
|
||||
processManager: processManager,
|
||||
artifacts: artifacts,
|
||||
logger: logger,
|
||||
fileSystem: fileSystem,
|
||||
outputDir: outputDir,
|
||||
defines: <String, String>{
|
||||
kIosArchs: 'arm64',
|
||||
kSdkRoot: 'path/to/iPhoneOS.sdk',
|
||||
kBitcodeFlag: '',
|
||||
kCodesignIdentity: 'ABC123',
|
||||
},
|
||||
);
|
||||
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
copyPhysicalFrameworkCommand,
|
||||
lipoCommandNonFatResult,
|
||||
lipoVerifyArm64Command,
|
||||
bitcodeStripCommand,
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
'xattr',
|
||||
'-r',
|
||||
'-d',
|
||||
'com.apple.FinderInfo',
|
||||
binary.path,
|
||||
],
|
||||
exitCode: 1,
|
||||
stderr: 'Failed to remove extended attributes',
|
||||
),
|
||||
FakeCommand(command: <String>[
|
||||
'codesign',
|
||||
'--force',
|
||||
'--sign',
|
||||
'ABC123',
|
||||
'--timestamp=none',
|
||||
binary.path,
|
||||
]),
|
||||
]);
|
||||
|
||||
await const DebugUnpackIOS().build(environment);
|
||||
expect(logger.traceText, contains('Failed to remove extended attributes'));
|
||||
});
|
||||
|
||||
testWithoutContext('fails when codesign fails', () async {
|
||||
binary.createSync(recursive: true);
|
||||
|
||||
@@ -644,6 +715,7 @@ void main() {
|
||||
lipoCommandNonFatResult,
|
||||
lipoVerifyArm64Command,
|
||||
bitcodeStripCommand,
|
||||
xattrRemoveCommand,
|
||||
FakeCommand(command: <String>[
|
||||
'codesign',
|
||||
'--force',
|
||||
@@ -688,6 +760,7 @@ void main() {
|
||||
lipoCommandNonFatResult,
|
||||
lipoVerifyArm64Command,
|
||||
bitcodeStripCommand,
|
||||
xattrRemoveCommand,
|
||||
FakeCommand(command: <String>[
|
||||
'codesign',
|
||||
'--force',
|
||||
|
||||
Reference in New Issue
Block a user