Skip to content

Commit 4d17998

Browse files
authored
iOS,macOS: Do not copy unsigned_binaries.txt to build outputs (flutter#154684)
There are three categories of binaries produced as part of the framework artifacts: * Those that use APIs that require entitlements and must be code-signed; e.g. gen_snapshot * Those that do not use APIs that require entitlements and must be code-signed; e.g. Flutter.framework dylib. * Those that do not need to be code-signed; e.g. Flutter.dSYM symbols. We are adding the third category in flutter/engine#54977. The Cocoon code signing aspect of this was handled in flutter/cocoon#3890. This ensures these files don't get copied into the build output should they appear in the artifact cache. Issue: flutter#154571
1 parent 6dc8820 commit 4d17998

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

packages/flutter_tools/lib/src/build_system/targets/macos.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,12 @@ abstract class UnpackMacOS extends Target {
8787
await _thinFramework(environment, frameworkBinaryPath);
8888
}
8989

90-
static const List<String> _copyDenylist = <String>['entitlements.txt', 'without_entitlements.txt'];
90+
/// Files that should not be copied to build output directory if found during framework copy step.
91+
static const List<String> _copyDenylist = <String>[
92+
'entitlements.txt',
93+
'without_entitlements.txt',
94+
'unsigned_binaries.txt',
95+
];
9196

9297
void _removeDenylistedFiles(Directory directory) {
9398
for (final FileSystemEntity entity in directory.listSync(recursive: true)) {

packages/flutter_tools/lib/src/cache.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,11 @@ class ArtifactUpdater {
10341034
final List<File> downloadedFiles = <File>[];
10351035

10361036
/// These filenames, should they exist after extracting an archive, should be deleted.
1037-
static const Set<String> _denylistedBasenames = <String>{'entitlements.txt', 'without_entitlements.txt'};
1037+
static const Set<String> _denylistedBasenames = <String>{
1038+
'entitlements.txt',
1039+
'without_entitlements.txt',
1040+
'unsigned_binaries.txt',
1041+
};
10381042
void _removeDenylistedFiles(Directory directory) {
10391043
for (final FileSystemEntity entity in directory.listSync(recursive: true)) {
10401044
if (entity is! File) {

packages/flutter_tools/test/general.shard/artifact_updater_test.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,15 @@ void main() {
8383
File? desiredArtifact;
8484
File? entitlementsFile;
8585
File? nestedWithoutEntitlementsFile;
86+
File? unsignedBinariesFile;
8687
operatingSystemUtils.unzipCallbacks[localZipPath] = (Directory outputDirectory) {
8788
desiredArtifact = outputDirectory.childFile('artifact.bin')..createSync();
8889
entitlementsFile = outputDirectory.childFile('entitlements.txt')..createSync();
8990
nestedWithoutEntitlementsFile = outputDirectory
9091
.childDirectory('dir')
9192
.childFile('without_entitlements.txt')
9293
..createSync(recursive: true);
94+
unsignedBinariesFile = outputDirectory.childFile('unsigned_binaries.txt')..createSync();
9395
};
9496
final ArtifactUpdater artifactUpdater = ArtifactUpdater(
9597
fileSystem: fileSystem,
@@ -114,6 +116,7 @@ void main() {
114116
expect(desiredArtifact, exists);
115117
expect(entitlementsFile, isNot(exists));
116118
expect(nestedWithoutEntitlementsFile, isNot(exists));
119+
expect(unsignedBinariesFile, isNot(exists));
117120
expect(staleEntitlementsFile, isNot(exists));
118121
});
119122

packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,11 @@ void main() {
173173
ProcessManager: () => processManager,
174174
});
175175

176-
testUsingContext('deletes entitlements.txt and without_entitlements.txt files after copying', () async {
176+
testUsingContext('deletes entitlements.txt, without_entitlements.txt, unsigned_binaries.txt files after copying', () async {
177177
binary.createSync(recursive: true);
178178
final File entitlements = environment.outputDir.childFile('entitlements.txt');
179179
final File withoutEntitlements = environment.outputDir.childFile('without_entitlements.txt');
180+
final File unsignedBinaries = environment.outputDir.childFile('unsigned_binaries.txt');
180181
final File nestedEntitlements = environment
181182
.outputDir
182183
.childDirectory('first_level')
@@ -201,6 +202,7 @@ void main() {
201202
onRun: (_) {
202203
entitlements.writeAsStringSync('foo');
203204
withoutEntitlements.writeAsStringSync('bar');
205+
unsignedBinaries.writeAsStringSync('baz');
204206
nestedEntitlements.writeAsStringSync('somefile.bin');
205207
},
206208
),
@@ -211,6 +213,7 @@ void main() {
211213
await const DebugUnpackMacOS().build(environment);
212214
expect(entitlements.existsSync(), isFalse);
213215
expect(withoutEntitlements.existsSync(), isFalse);
216+
expect(unsignedBinaries.existsSync(), isFalse);
214217
expect(nestedEntitlements.existsSync(), isFalse);
215218

216219
expect(processManager, hasNoRemainingExpectations);

0 commit comments

Comments
 (0)