Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
d2b06875
Unverified
Commit
d2b06875
authored
Apr 28, 2021
by
Jenn Magder
Committed by
GitHub
Apr 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Finder extended attributes before code signing iOS frameworks (#81342)
parent
1a3af88c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
7 deletions
+93
-7
ios.dart
packages/flutter_tools/lib/src/build_system/targets/ios.dart
+16
-3
ios_test.dart
...ols/test/general.shard/build_system/targets/ios_test.dart
+77
-4
No files found.
packages/flutter_tools/lib/src/build_system/targets/ios.dart
View file @
d2b06875
...
@@ -626,7 +626,20 @@ void _signFramework(Environment environment, String binaryPath, BuildMode buildM
...
@@ -626,7 +626,20 @@ void _signFramework(Environment environment, String binaryPath, BuildMode buildM
if
(
codesignIdentity
==
null
||
codesignIdentity
.
isEmpty
)
{
if
(
codesignIdentity
==
null
||
codesignIdentity
.
isEmpty
)
{
return
;
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'
,
'codesign'
,
'--force'
,
'--force'
,
'--sign'
,
'--sign'
,
...
@@ -637,7 +650,7 @@ void _signFramework(Environment environment, String binaryPath, BuildMode buildM
...
@@ -637,7 +650,7 @@ void _signFramework(Environment environment, String binaryPath, BuildMode buildM
],
],
binaryPath
,
binaryPath
,
]);
]);
if
(
r
esult
.
exitCode
!=
0
)
{
if
(
codesignR
esult
.
exitCode
!=
0
)
{
throw
Exception
(
'Failed to codesign
$binaryPath
with identity
$codesignIdentity
.
\n
${
r
esult.stderr}
'
);
throw
Exception
(
'Failed to codesign
$binaryPath
with identity
$codesignIdentity
.
\n
${
codesignR
esult.stderr}
'
);
}
}
}
}
packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart
View file @
d2b06875
...
@@ -138,7 +138,14 @@ void main() {
...
@@ -138,7 +138,14 @@ void main() {
final
Directory
frameworkDirectory
=
environment
.
outputDir
.
childDirectory
(
'App.framework'
);
final
Directory
frameworkDirectory
=
environment
.
outputDir
.
childDirectory
(
'App.framework'
);
final
File
frameworkDirectoryBinary
=
frameworkDirectory
.
childFile
(
'App'
);
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
>[
FakeCommand
(
command:
<
String
>[
'codesign'
,
'codesign'
,
'--force'
,
'--force'
,
...
@@ -147,7 +154,7 @@ void main() {
...
@@ -147,7 +154,7 @@ void main() {
'--timestamp=none'
,
'--timestamp=none'
,
frameworkDirectoryBinary
.
path
,
frameworkDirectoryBinary
.
path
,
]),
]),
);
]
);
await
const
DebugIosApplicationBundle
().
build
(
environment
);
await
const
DebugIosApplicationBundle
().
build
(
environment
);
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
...
@@ -184,7 +191,14 @@ void main() {
...
@@ -184,7 +191,14 @@ void main() {
final
Directory
frameworkDirectory
=
environment
.
outputDir
.
childDirectory
(
'App.framework'
);
final
Directory
frameworkDirectory
=
environment
.
outputDir
.
childDirectory
(
'App.framework'
);
final
File
frameworkDirectoryBinary
=
frameworkDirectory
.
childFile
(
'App'
);
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
>[
FakeCommand
(
command:
<
String
>[
'codesign'
,
'codesign'
,
'--force'
,
'--force'
,
...
@@ -192,7 +206,7 @@ void main() {
...
@@ -192,7 +206,7 @@ void main() {
'ABC123'
,
'ABC123'
,
frameworkDirectoryBinary
.
path
,
frameworkDirectoryBinary
.
path
,
]),
]),
);
]
);
await
const
ReleaseIosApplicationBundle
().
build
(
environment
);
await
const
ReleaseIosApplicationBundle
().
build
(
environment
);
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
...
@@ -277,6 +291,7 @@ void main() {
...
@@ -277,6 +291,7 @@ void main() {
FakeCommand
lipoCommandNonFatResult
;
FakeCommand
lipoCommandNonFatResult
;
FakeCommand
lipoVerifyArm64Command
;
FakeCommand
lipoVerifyArm64Command
;
FakeCommand
bitcodeStripCommand
;
FakeCommand
bitcodeStripCommand
;
FakeCommand
xattrRemoveCommand
;
setUp
(()
{
setUp
(()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
...
@@ -313,6 +328,14 @@ void main() {
...
@@ -313,6 +328,14 @@ void main() {
'-o'
,
'-o'
,
binary
.
path
,
binary
.
path
,
]);
]);
xattrRemoveCommand
=
FakeCommand
(
command:
<
String
>[
'xattr'
,
'-r'
,
'-d'
,
'com.apple.FinderInfo'
,
binary
.
path
,
]);
});
});
testWithoutContext
(
'iphonesimulator'
,
()
async
{
testWithoutContext
(
'iphonesimulator'
,
()
async
{
...
@@ -621,6 +644,54 @@ void main() {
...
@@ -621,6 +644,54 @@ void main() {
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
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
{
testWithoutContext
(
'fails when codesign fails'
,
()
async
{
binary
.
createSync
(
recursive:
true
);
binary
.
createSync
(
recursive:
true
);
...
@@ -644,6 +715,7 @@ void main() {
...
@@ -644,6 +715,7 @@ void main() {
lipoCommandNonFatResult
,
lipoCommandNonFatResult
,
lipoVerifyArm64Command
,
lipoVerifyArm64Command
,
bitcodeStripCommand
,
bitcodeStripCommand
,
xattrRemoveCommand
,
FakeCommand
(
command:
<
String
>[
FakeCommand
(
command:
<
String
>[
'codesign'
,
'codesign'
,
'--force'
,
'--force'
,
...
@@ -688,6 +760,7 @@ void main() {
...
@@ -688,6 +760,7 @@ void main() {
lipoCommandNonFatResult
,
lipoCommandNonFatResult
,
lipoVerifyArm64Command
,
lipoVerifyArm64Command
,
bitcodeStripCommand
,
bitcodeStripCommand
,
xattrRemoveCommand
,
FakeCommand
(
command:
<
String
>[
FakeCommand
(
command:
<
String
>[
'codesign'
,
'codesign'
,
'--force'
,
'--force'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment