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
3e6fe491
Unverified
Commit
3e6fe491
authored
May 06, 2021
by
Jenn Magder
Committed by
GitHub
May 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove extended attributes from entire Flutter project (#81435)
parent
0bba935b
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
106 deletions
+20
-106
ios.dart
packages/flutter_tools/lib/src/build_system/targets/ios.dart
+3
-16
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+4
-4
build_ios_test.dart
...er_tools/test/commands.shard/hermetic/build_ios_test.dart
+1
-1
build_ipa_test.dart
...er_tools/test/commands.shard/hermetic/build_ipa_test.dart
+1
-1
ios_test.dart
...ols/test/general.shard/build_system/targets/ios_test.dart
+4
-77
ios_device_start_nonprebuilt_test.dart
.../general.shard/ios/ios_device_start_nonprebuilt_test.dart
+1
-1
mac_test.dart
packages/flutter_tools/test/general.shard/ios/mac_test.dart
+6
-6
No files found.
packages/flutter_tools/lib/src/build_system/targets/ios.dart
View file @
3e6fe491
...
...
@@ -626,20 +626,7 @@ void _signFramework(Environment environment, String binaryPath, BuildMode buildM
if
(
codesignIdentity
==
null
||
codesignIdentity
.
isEmpty
)
{
return
;
}
// 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
>[
final
ProcessResult
result
=
environment
.
processManager
.
runSync
(<
String
>[
'codesign'
,
'--force'
,
'--sign'
,
...
...
@@ -650,7 +637,7 @@ void _signFramework(Environment environment, String binaryPath, BuildMode buildM
],
binaryPath
,
]);
if
(
codesignR
esult
.
exitCode
!=
0
)
{
throw
Exception
(
'Failed to codesign
$binaryPath
with identity
$codesignIdentity
.
\n
${
codesignR
esult.stderr}
'
);
if
(
r
esult
.
exitCode
!=
0
)
{
throw
Exception
(
'Failed to codesign
$binaryPath
with identity
$codesignIdentity
.
\n
${
r
esult.stderr}
'
);
}
}
packages/flutter_tools/lib/src/ios/mac.dart
View file @
3e6fe491
...
...
@@ -122,7 +122,7 @@ Future<XcodeBuildResult> buildXcodeProject({
return
XcodeBuildResult
(
success:
false
);
}
await
removeFinderExtendedAttributes
(
app
.
project
.
hostAppRoot
,
globals
.
processUtils
,
globals
.
logger
);
await
removeFinderExtendedAttributes
(
app
.
project
.
parent
.
directory
,
globals
.
processUtils
,
globals
.
logger
);
final
XcodeProjectInfo
projectInfo
=
await
app
.
project
.
projectInfo
();
final
String
scheme
=
projectInfo
.
schemeFor
(
buildInfo
);
...
...
@@ -445,19 +445,19 @@ 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
iosP
rojectDirectory
,
ProcessUtils
processUtils
,
Logger
logger
)
async
{
Future
<
void
>
removeFinderExtendedAttributes
(
Directory
p
rojectDirectory
,
ProcessUtils
processUtils
,
Logger
logger
)
async
{
final
bool
success
=
await
processUtils
.
exitsHappy
(
<
String
>[
'xattr'
,
'-r'
,
'-d'
,
'com.apple.FinderInfo'
,
iosP
rojectDirectory
.
path
,
p
rojectDirectory
.
path
,
]
);
// Ignore all errors, for example if directory is missing.
if
(!
success
)
{
logger
.
printTrace
(
'Failed to remove xattr com.apple.FinderInfo from
${
iosP
rojectDirectory.path}
'
);
logger
.
printTrace
(
'Failed to remove xattr com.apple.FinderInfo from
${
p
rojectDirectory.path}
'
);
}
}
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_ios_test.dart
View file @
3e6fe491
...
...
@@ -75,7 +75,7 @@ void main() {
}
const
FakeCommand
xattrCommand
=
FakeCommand
(
command:
<
String
>[
'xattr'
,
'-r'
,
'-d'
,
'com.apple.FinderInfo'
,
'/
ios
'
'xattr'
,
'-r'
,
'-d'
,
'com.apple.FinderInfo'
,
'/'
]);
FakeCommand
_setUpRsyncCommand
({
void
Function
()
onRun
})
{
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_ipa_test.dart
View file @
3e6fe491
...
...
@@ -76,7 +76,7 @@ void main() {
}
const
FakeCommand
xattrCommand
=
FakeCommand
(
command:
<
String
>[
'xattr'
,
'-r'
,
'-d'
,
'com.apple.FinderInfo'
,
'/
ios
'
'xattr'
,
'-r'
,
'-d'
,
'com.apple.FinderInfo'
,
'/'
]);
// Creates a FakeCommand for the xcodebuild call to build the app
...
...
packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart
View file @
3e6fe491
...
...
@@ -138,14 +138,7 @@ void main() {
final
Directory
frameworkDirectory
=
environment
.
outputDir
.
childDirectory
(
'App.framework'
);
final
File
frameworkDirectoryBinary
=
frameworkDirectory
.
childFile
(
'App'
);
processManager
.
addCommands
(<
FakeCommand
>[
FakeCommand
(
command:
<
String
>[
'xattr'
,
'-r'
,
'-d'
,
'com.apple.FinderInfo'
,
frameworkDirectoryBinary
.
path
,
]),
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
'codesign'
,
'--force'
,
...
...
@@ -154,7 +147,7 @@ void main() {
'--timestamp=none'
,
frameworkDirectoryBinary
.
path
,
]),
]
);
);
await
const
DebugIosApplicationBundle
().
build
(
environment
);
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
...
...
@@ -191,14 +184,7 @@ void main() {
final
Directory
frameworkDirectory
=
environment
.
outputDir
.
childDirectory
(
'App.framework'
);
final
File
frameworkDirectoryBinary
=
frameworkDirectory
.
childFile
(
'App'
);
processManager
.
addCommands
(<
FakeCommand
>[
FakeCommand
(
command:
<
String
>[
'xattr'
,
'-r'
,
'-d'
,
'com.apple.FinderInfo'
,
frameworkDirectoryBinary
.
path
,
]),
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
'codesign'
,
'--force'
,
...
...
@@ -206,7 +192,7 @@ void main() {
'ABC123'
,
frameworkDirectoryBinary
.
path
,
]),
]
);
);
await
const
ReleaseIosApplicationBundle
().
build
(
environment
);
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
...
...
@@ -291,7 +277,6 @@ void main() {
FakeCommand
lipoCommandNonFatResult
;
FakeCommand
lipoVerifyArm64Command
;
FakeCommand
bitcodeStripCommand
;
FakeCommand
xattrRemoveCommand
;
setUp
(()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
...
...
@@ -328,14 +313,6 @@ void main() {
'-o'
,
binary
.
path
,
]);
xattrRemoveCommand
=
FakeCommand
(
command:
<
String
>[
'xattr'
,
'-r'
,
'-d'
,
'com.apple.FinderInfo'
,
binary
.
path
,
]);
});
testWithoutContext
(
'iphonesimulator'
,
()
async
{
...
...
@@ -644,54 +621,6 @@ 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
);
...
...
@@ -715,7 +644,6 @@ void main() {
lipoCommandNonFatResult
,
lipoVerifyArm64Command
,
bitcodeStripCommand
,
xattrRemoveCommand
,
FakeCommand
(
command:
<
String
>[
'codesign'
,
'--force'
,
...
...
@@ -760,7 +688,6 @@ void main() {
lipoCommandNonFatResult
,
lipoVerifyArm64Command
,
bitcodeStripCommand
,
xattrRemoveCommand
,
FakeCommand
(
command:
<
String
>[
'codesign'
,
'--force'
,
...
...
packages/flutter_tools/test/general.shard/ios/ios_device_start_nonprebuilt_test.dart
View file @
3e6fe491
...
...
@@ -37,7 +37,7 @@ List<String> _xattrArgs(FlutterProject flutterProject) {
'-r'
,
'-d'
,
'com.apple.FinderInfo'
,
flutterProject
.
ios
.
hostAppRoot
.
path
,
flutterProject
.
directory
.
path
,
];
}
...
...
packages/flutter_tools/test/general.shard/ios/mac_test.dart
View file @
3e6fe491
...
...
@@ -445,10 +445,10 @@ Exited (sigterm)''',
});
group('remove Finder extended attributes', () {
Directory
iosP
rojectDirectory;
Directory
p
rojectDirectory;
setUp(() {
final MemoryFileSystem fs = MemoryFileSystem.test();
iosProjectDirectory = fs.directory('ios
');
projectDirectory = fs.directory('flutter_project
');
});
testWithoutContext('removes xattr', () async {
...
...
@@ -458,11 +458,11 @@ Exited (sigterm)''',
'-r',
'-d',
'com.apple.FinderInfo',
iosP
rojectDirectory.path,
p
rojectDirectory.path,
])
]);
await removeFinderExtendedAttributes(
iosP
rojectDirectory, ProcessUtils(processManager: processManager, logger: logger), logger);
await removeFinderExtendedAttributes(
p
rojectDirectory, ProcessUtils(processManager: processManager, logger: logger), logger);
expect(processManager, hasNoRemainingExpectations);
});
...
...
@@ -473,12 +473,12 @@ Exited (sigterm)''',
'-r',
'-d',
'com.apple.FinderInfo',
iosP
rojectDirectory.path,
p
rojectDirectory.path,
], exitCode: 1,
)
]);
await removeFinderExtendedAttributes(
iosP
rojectDirectory, ProcessUtils(processManager: processManager, logger: logger), logger);
await removeFinderExtendedAttributes(
p
rojectDirectory, ProcessUtils(processManager: processManager, logger: logger), logger);
expect(logger.traceText, contains('Failed to remove xattr com.apple.FinderInfo'));
expect(processManager, hasNoRemainingExpectations);
});
...
...
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