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
ddf63a8b
Unverified
Commit
ddf63a8b
authored
Apr 14, 2020
by
Jenn Magder
Committed by
GitHub
Apr 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Finder extended attributes from iOS project files (#54488)
parent
f646e26e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
0 deletions
+76
-0
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+21
-0
ios_device_start_nonprebuilt_test.dart
.../general.shard/ios/ios_device_start_nonprebuilt_test.dart
+13
-0
mac_test.dart
packages/flutter_tools/test/general.shard/ios/mac_test.dart
+42
-0
No files found.
packages/flutter_tools/lib/src/ios/mac.dart
View file @
ddf63a8b
...
...
@@ -105,6 +105,8 @@ Future<XcodeBuildResult> buildXcodeProject({
return
XcodeBuildResult
(
success:
false
);
}
await
removeFinderExtendedAttributes
(
app
.
project
.
hostAppRoot
,
processUtils
,
globals
.
logger
);
final
XcodeProjectInfo
projectInfo
=
await
globals
.
xcodeProjectInterpreter
.
getInfo
(
app
.
project
.
hostAppRoot
.
path
);
if
(!
projectInfo
.
targets
.
contains
(
'Runner'
))
{
globals
.
printError
(
'The Xcode project does not define target "Runner" which is needed by Flutter tooling.'
);
...
...
@@ -405,6 +407,25 @@ 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
iosProjectDirectory
,
ProcessUtils
processUtils
,
Logger
logger
)
async
{
final
bool
success
=
await
processUtils
.
exitsHappy
(
<
String
>[
'xattr'
,
'-r'
,
'-d'
,
'com.apple.FinderInfo'
,
iosProjectDirectory
.
path
,
]
);
// Ignore all errors, for example if directory is missing.
if
(!
success
)
{
logger
.
printTrace
(
'Failed to remove xattr com.apple.FinderInfo from
${iosProjectDirectory.path}
'
);
}
}
Future
<
RunResult
>
_runBuildWithRetries
(
List
<
String
>
buildCommands
,
BuildableIOSApp
app
)
async
{
int
buildRetryDelaySeconds
=
1
;
int
remainingTries
=
8
;
...
...
packages/flutter_tools/test/general.shard/ios/ios_device_start_nonprebuilt_test.dart
View file @
ddf63a8b
...
...
@@ -22,6 +22,16 @@ import '../../src/common.dart';
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
List
<
String
>
_xattrArgs
(
FlutterProject
flutterProject
)
{
return
<
String
>[
'xattr'
,
'-r'
,
'-d'
,
'com.apple.FinderInfo'
,
flutterProject
.
ios
.
hostAppRoot
.
path
,
];
}
const
List
<
String
>
kRunReleaseArgs
=
<
String
>[
'/usr/bin/env'
,
'xcrun'
,
...
...
@@ -74,6 +84,7 @@ void main() {
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectory
(
fileSystem
.
currentDirectory
);
final
BuildableIOSApp
buildableIOSApp
=
BuildableIOSApp
(
flutterProject
.
ios
,
'flutter'
);
processManager
.
addCommand
(
FakeCommand
(
command:
_xattrArgs
(
flutterProject
)));
processManager
.
addCommand
(
const
FakeCommand
(
command:
kRunReleaseArgs
));
processManager
.
addCommand
(
const
FakeCommand
(
command:
<
String
>[...
kRunReleaseArgs
,
'-showBuildSettings'
]));
processManager
.
addCommand
(
FakeCommand
(
...
...
@@ -123,6 +134,7 @@ void main() {
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectory
(
fileSystem
.
currentDirectory
);
final
BuildableIOSApp
buildableIOSApp
=
BuildableIOSApp
(
flutterProject
.
ios
,
'flutter'
);
processManager
.
addCommand
(
FakeCommand
(
command:
_xattrArgs
(
flutterProject
)));
processManager
.
addCommand
(
const
FakeCommand
(
command:
kRunReleaseArgs
));
// The first showBuildSettings call should timeout.
processManager
.
addCommand
(
...
...
@@ -194,6 +206,7 @@ void main() {
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectory
(
fileSystem
.
currentDirectory
);
final
BuildableIOSApp
buildableIOSApp
=
BuildableIOSApp
(
flutterProject
.
ios
,
'flutter'
);
processManager
.
addCommand
(
FakeCommand
(
command:
_xattrArgs
(
flutterProject
)));
// The first xcrun call should fail with a
// concurrent build exception.
processManager
.
addCommand
(
...
...
packages/flutter_tools/test/general.shard/ios/mac_test.dart
View file @
ddf63a8b
...
...
@@ -5,10 +5,12 @@
import
'dart:async'
;
import
'package:file/file.dart'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
show
ProcessResult
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/process.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/ios/mac.dart'
;
import
'package:flutter_tools/src/ios/xcodeproj.dart'
;
...
...
@@ -428,6 +430,46 @@ Exited (sigterm)''',
);
});
});
group('remove Finder extended attributes', () {
Directory iosProjectDirectory;
setUp(() {
final MemoryFileSystem fs = MemoryFileSystem.test();
iosProjectDirectory = fs.directory('ios');
});
testWithoutContext('removes xattr', () async {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(command: <String>[
'xattr',
'-r',
'-d',
'com.apple.FinderInfo',
iosProjectDirectory.path,
])
]);
await removeFinderExtendedAttributes(iosProjectDirectory, ProcessUtils(processManager: processManager, logger: logger), logger);
expect(processManager.hasRemainingExpectations, false);
});
testWithoutContext('ignores errors', () async {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(command: <String>[
'xattr',
'-r',
'-d',
'com.apple.FinderInfo',
iosProjectDirectory.path,
], exitCode: 1,
)
]);
await removeFinderExtendedAttributes(iosProjectDirectory, ProcessUtils(processManager: processManager, logger: logger), logger);
expect(logger.traceText, contains('Failed to remove xattr com.apple.FinderInfo'));
expect(processManager.hasRemainingExpectations, false);
});
});
}
class MockUsage extends Mock implements Usage {}
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