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
...
@@ -626,20 +626,7 @@ 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'
,
...
@@ -650,7 +637,7 @@ void _signFramework(Environment environment, String binaryPath, BuildMode buildM
...
@@ -650,7 +637,7 @@ void _signFramework(Environment environment, String binaryPath, BuildMode buildM
],
],
binaryPath
,
binaryPath
,
]);
]);
if
(
codesignR
esult
.
exitCode
!=
0
)
{
if
(
r
esult
.
exitCode
!=
0
)
{
throw
Exception
(
'Failed to codesign
$binaryPath
with identity
$codesignIdentity
.
\n
${
codesignR
esult.stderr}
'
);
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({
...
@@ -122,7 +122,7 @@ Future<XcodeBuildResult> buildXcodeProject({
return
XcodeBuildResult
(
success:
false
);
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
XcodeProjectInfo
projectInfo
=
await
app
.
project
.
projectInfo
();
final
String
scheme
=
projectInfo
.
schemeFor
(
buildInfo
);
final
String
scheme
=
projectInfo
.
schemeFor
(
buildInfo
);
...
@@ -445,19 +445,19 @@ Future<XcodeBuildResult> buildXcodeProject({
...
@@ -445,19 +445,19 @@ Future<XcodeBuildResult> buildXcodeProject({
/// Extended attributes applied by Finder can cause code signing errors. Remove them.
/// Extended attributes applied by Finder can cause code signing errors. Remove them.
/// https://developer.apple.com/library/archive/qa/qa1940/_index.html
/// https://developer.apple.com/library/archive/qa/qa1940/_index.html
@visibleForTesting
@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
(
final
bool
success
=
await
processUtils
.
exitsHappy
(
<
String
>[
<
String
>[
'xattr'
,
'xattr'
,
'-r'
,
'-r'
,
'-d'
,
'-d'
,
'com.apple.FinderInfo'
,
'com.apple.FinderInfo'
,
iosP
rojectDirectory
.
path
,
p
rojectDirectory
.
path
,
]
]
);
);
// Ignore all errors, for example if directory is missing.
// Ignore all errors, for example if directory is missing.
if
(!
success
)
{
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() {
...
@@ -75,7 +75,7 @@ void main() {
}
}
const
FakeCommand
xattrCommand
=
FakeCommand
(
command:
<
String
>[
const
FakeCommand
xattrCommand
=
FakeCommand
(
command:
<
String
>[
'xattr'
,
'-r'
,
'-d'
,
'com.apple.FinderInfo'
,
'/
ios
'
'xattr'
,
'-r'
,
'-d'
,
'com.apple.FinderInfo'
,
'/'
]);
]);
FakeCommand
_setUpRsyncCommand
({
void
Function
()
onRun
})
{
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() {
...
@@ -76,7 +76,7 @@ void main() {
}
}
const
FakeCommand
xattrCommand
=
FakeCommand
(
command:
<
String
>[
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
// 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() {
...
@@ -138,14 +138,7 @@ 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
.
addCommands
(<
FakeCommand
>[
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
'xattr'
,
'-r'
,
'-d'
,
'com.apple.FinderInfo'
,
frameworkDirectoryBinary
.
path
,
]),
FakeCommand
(
command:
<
String
>[
FakeCommand
(
command:
<
String
>[
'codesign'
,
'codesign'
,
'--force'
,
'--force'
,
...
@@ -154,7 +147,7 @@ void main() {
...
@@ -154,7 +147,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
);
...
@@ -191,14 +184,7 @@ void main() {
...
@@ -191,14 +184,7 @@ 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
.
addCommands
(<
FakeCommand
>[
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
'xattr'
,
'-r'
,
'-d'
,
'com.apple.FinderInfo'
,
frameworkDirectoryBinary
.
path
,
]),
FakeCommand
(
command:
<
String
>[
FakeCommand
(
command:
<
String
>[
'codesign'
,
'codesign'
,
'--force'
,
'--force'
,
...
@@ -206,7 +192,7 @@ void main() {
...
@@ -206,7 +192,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
);
...
@@ -291,7 +277,6 @@ void main() {
...
@@ -291,7 +277,6 @@ 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
();
...
@@ -328,14 +313,6 @@ void main() {
...
@@ -328,14 +313,6 @@ 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
{
...
@@ -644,54 +621,6 @@ void main() {
...
@@ -644,54 +621,6 @@ 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
);
...
@@ -715,7 +644,6 @@ void main() {
...
@@ -715,7 +644,6 @@ void main() {
lipoCommandNonFatResult
,
lipoCommandNonFatResult
,
lipoVerifyArm64Command
,
lipoVerifyArm64Command
,
bitcodeStripCommand
,
bitcodeStripCommand
,
xattrRemoveCommand
,
FakeCommand
(
command:
<
String
>[
FakeCommand
(
command:
<
String
>[
'codesign'
,
'codesign'
,
'--force'
,
'--force'
,
...
@@ -760,7 +688,6 @@ void main() {
...
@@ -760,7 +688,6 @@ void main() {
lipoCommandNonFatResult
,
lipoCommandNonFatResult
,
lipoVerifyArm64Command
,
lipoVerifyArm64Command
,
bitcodeStripCommand
,
bitcodeStripCommand
,
xattrRemoveCommand
,
FakeCommand
(
command:
<
String
>[
FakeCommand
(
command:
<
String
>[
'codesign'
,
'codesign'
,
'--force'
,
'--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) {
...
@@ -37,7 +37,7 @@ List<String> _xattrArgs(FlutterProject flutterProject) {
'-r'
,
'-r'
,
'-d'
,
'-d'
,
'com.apple.FinderInfo'
,
'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)''',
...
@@ -445,10 +445,10 @@ Exited (sigterm)''',
});
});
group('remove Finder extended attributes', () {
group('remove Finder extended attributes', () {
Directory
iosP
rojectDirectory;
Directory
p
rojectDirectory;
setUp(() {
setUp(() {
final MemoryFileSystem fs = MemoryFileSystem.test();
final MemoryFileSystem fs = MemoryFileSystem.test();
iosProjectDirectory = fs.directory('ios
');
projectDirectory = fs.directory('flutter_project
');
});
});
testWithoutContext('removes xattr', () async {
testWithoutContext('removes xattr', () async {
...
@@ -458,11 +458,11 @@ Exited (sigterm)''',
...
@@ -458,11 +458,11 @@ Exited (sigterm)''',
'-r',
'-r',
'-d',
'-d',
'com.apple.FinderInfo',
'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);
expect(processManager, hasNoRemainingExpectations);
});
});
...
@@ -473,12 +473,12 @@ Exited (sigterm)''',
...
@@ -473,12 +473,12 @@ Exited (sigterm)''',
'-r',
'-r',
'-d',
'-d',
'com.apple.FinderInfo',
'com.apple.FinderInfo',
iosP
rojectDirectory.path,
p
rojectDirectory.path,
], exitCode: 1,
], 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(logger.traceText, contains('Failed to remove xattr com.apple.FinderInfo'));
expect(processManager, hasNoRemainingExpectations);
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