Skip to content

Commit b4d7275

Browse files
authored
Add Info.plist from build directory as input path to Thin Binary build phase (#118209)
* Add Info.plist from build directory as input path to Thin Binary build phase * fix directive ordering * migrate benchmark, integration, and example tests
1 parent cea55d9 commit b4d7275

File tree

35 files changed

+214
-0
lines changed

35 files changed

+214
-0
lines changed

dev/benchmarks/complex_layout/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@
232232
files = (
233233
);
234234
inputPaths = (
235+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
235236
);
236237
name = "Thin Binary";
237238
outputPaths = (

dev/benchmarks/macrobenchmarks/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@
236236
files = (
237237
);
238238
inputPaths = (
239+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
239240
);
240241
name = "Thin Binary";
241242
outputPaths = (

dev/benchmarks/microbenchmarks/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@
187187
files = (
188188
);
189189
inputPaths = (
190+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
190191
);
191192
name = "Thin Binary";
192193
outputPaths = (

dev/benchmarks/platform_channels_benchmarks/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
files = (
180180
);
181181
inputPaths = (
182+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
182183
);
183184
name = "Thin Binary";
184185
outputPaths = (

dev/benchmarks/platform_views_layout/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@
191191
files = (
192192
);
193193
inputPaths = (
194+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
194195
);
195196
name = "Thin Binary";
196197
outputPaths = (

dev/benchmarks/platform_views_layout_hybrid_composition/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@
192192
files = (
193193
);
194194
inputPaths = (
195+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
195196
);
196197
name = "Thin Binary";
197198
outputPaths = (

dev/benchmarks/test_apps/stocks/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@
194194
files = (
195195
);
196196
inputPaths = (
197+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
197198
);
198199
name = "Thin Binary";
199200
outputPaths = (

dev/integration_tests/channels/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@
186186
files = (
187187
);
188188
inputPaths = (
189+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
189190
);
190191
name = "Thin Binary";
191192
outputPaths = (

dev/integration_tests/external_ui/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@
177177
files = (
178178
);
179179
inputPaths = (
180+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
180181
);
181182
name = "Thin Binary";
182183
outputPaths = (

dev/integration_tests/flavors/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@
288288
files = (
289289
);
290290
inputPaths = (
291+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
291292
);
292293
name = "Thin Binary";
293294
outputPaths = (

dev/integration_tests/flutter_gallery/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@
213213
files = (
214214
);
215215
inputPaths = (
216+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
216217
);
217218
name = "Thin Binary";
218219
outputPaths = (

dev/integration_tests/ios_app_with_extensions/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@
380380
files = (
381381
);
382382
inputPaths = (
383+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
383384
);
384385
name = "Thin Binary";
385386
outputPaths = (

dev/integration_tests/ios_platform_view_tests/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@
256256
files = (
257257
);
258258
inputPaths = (
259+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
259260
);
260261
name = "Thin Binary";
261262
outputPaths = (

dev/integration_tests/non_nullable/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@
184184
files = (
185185
);
186186
inputPaths = (
187+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
187188
);
188189
name = "Thin Binary";
189190
outputPaths = (

dev/integration_tests/platform_interaction/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@
191191
files = (
192192
);
193193
inputPaths = (
194+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
194195
);
195196
name = "Thin Binary";
196197
outputPaths = (

dev/integration_tests/release_smoke_test/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@
214214
files = (
215215
);
216216
inputPaths = (
217+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
217218
);
218219
name = "Thin Binary";
219220
outputPaths = (

dev/integration_tests/spell_check/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@
186186
files = (
187187
);
188188
inputPaths = (
189+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
189190
);
190191
name = "Thin Binary";
191192
outputPaths = (

dev/integration_tests/ui/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@
210210
files = (
211211
);
212212
inputPaths = (
213+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
213214
);
214215
name = "Thin Binary";
215216
outputPaths = (

dev/manual_tests/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@
176176
files = (
177177
);
178178
inputPaths = (
179+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
179180
);
180181
name = "Thin Binary";
181182
outputPaths = (

examples/api/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@
227227
files = (
228228
);
229229
inputPaths = (
230+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
230231
);
231232
name = "Thin Binary";
232233
outputPaths = (

examples/flutter_view/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@
196196
files = (
197197
);
198198
inputPaths = (
199+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
199200
);
200201
name = "Thin Binary";
201202
outputPaths = (

examples/hello_world/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@
194194
files = (
195195
);
196196
inputPaths = (
197+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
197198
);
198199
name = "Thin Binary";
199200
outputPaths = (

examples/image_list/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@
187187
files = (
188188
);
189189
inputPaths = (
190+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
190191
);
191192
name = "Thin Binary";
192193
outputPaths = (

examples/layers/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@
186186
files = (
187187
);
188188
inputPaths = (
189+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
189190
);
190191
name = "Thin Binary";
191192
outputPaths = (

examples/platform_channel/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@
194194
files = (
195195
);
196196
inputPaths = (
197+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
197198
);
198199
name = "Thin Binary";
199200
outputPaths = (

examples/platform_channel_swift/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@
192192
files = (
193193
);
194194
inputPaths = (
195+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
195196
);
196197
name = "Thin Binary";
197198
outputPaths = (

examples/platform_view/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
files = (
196196
);
197197
inputPaths = (
198+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
198199
);
199200
name = "Thin Binary";
200201
outputPaths = (

packages/flutter_tools/lib/src/ios/mac.dart

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import '../macos/cocoapod_utils.dart';
2222
import '../macos/xcode.dart';
2323
import '../migrations/xcode_project_object_version_migration.dart';
2424
import '../migrations/xcode_script_build_phase_migration.dart';
25+
import '../migrations/xcode_thin_binary_build_phase_input_paths_migration.dart';
2526
import '../project.dart';
2627
import '../reporting/reporting.dart';
2728
import 'application_package.dart';
@@ -130,6 +131,7 @@ Future<XcodeBuildResult> buildXcodeProject({
130131
HostAppInfoPlistMigration(app.project, globals.logger),
131132
XcodeScriptBuildPhaseMigration(app.project, globals.logger),
132133
RemoveBitcodeMigration(app.project, globals.logger),
134+
XcodeThinBinaryBuildPhaseInputPathsMigration(app.project, globals.logger),
133135
];
134136

135137
final ProjectMigration migration = ProjectMigration(migrators);

packages/flutter_tools/lib/src/macos/build_macos.dart

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import '../ios/xcode_build_settings.dart';
1414
import '../ios/xcodeproj.dart';
1515
import '../migrations/xcode_project_object_version_migration.dart';
1616
import '../migrations/xcode_script_build_phase_migration.dart';
17+
import '../migrations/xcode_thin_binary_build_phase_input_paths_migration.dart';
1718
import '../project.dart';
1819
import 'cocoapod_utils.dart';
1920
import 'migrations/macos_deployment_target_migration.dart';
@@ -52,6 +53,7 @@ Future<void> buildMacOS({
5253
MacOSDeploymentTargetMigration(flutterProject.macos, globals.logger),
5354
XcodeProjectObjectVersionMigration(flutterProject.macos, globals.logger),
5455
XcodeScriptBuildPhaseMigration(flutterProject.macos, globals.logger),
56+
XcodeThinBinaryBuildPhaseInputPathsMigration(flutterProject.macos, globals.logger),
5557
];
5658

5759
final ProjectMigration migration = ProjectMigration(migrators);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import '../base/file_system.dart';
6+
import '../base/project_migrator.dart';
7+
import '../xcode_project.dart';
8+
9+
// Migrate Xcode Thin Binary build phase to depend on Info.plist from build directory
10+
// as an input file to ensure it has been created before inserting the NSBonjourServices key
11+
// to avoid an mDNS error.
12+
class XcodeThinBinaryBuildPhaseInputPathsMigration extends ProjectMigrator {
13+
XcodeThinBinaryBuildPhaseInputPathsMigration(XcodeBasedProject project, super.logger)
14+
: _xcodeProjectInfoFile = project.xcodeProjectInfoFile;
15+
16+
final File _xcodeProjectInfoFile;
17+
18+
@override
19+
void migrate() {
20+
if (!_xcodeProjectInfoFile.existsSync()) {
21+
logger.printTrace('Xcode project not found, skipping script build phase dependency analysis removal.');
22+
return;
23+
}
24+
25+
final String originalProjectContents = _xcodeProjectInfoFile.readAsStringSync();
26+
27+
// Add Info.plist from build directory as an input file to Thin Binary build phase.
28+
// Path for the Info.plist is ${TARGET_BUILD_DIR}/\${INFOPLIST_PATH}
29+
30+
// Example:
31+
// 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
32+
// isa = PBXShellScriptBuildPhase;
33+
// alwaysOutOfDate = 1;
34+
// buildActionMask = 2147483647;
35+
// files = (
36+
// );
37+
// inputPaths = (
38+
// );
39+
40+
String newProjectContents = originalProjectContents;
41+
const String thinBinaryBuildPhaseOriginal = '''
42+
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
43+
isa = PBXShellScriptBuildPhase;
44+
alwaysOutOfDate = 1;
45+
buildActionMask = 2147483647;
46+
files = (
47+
);
48+
inputPaths = (
49+
);
50+
''';
51+
52+
const String thinBinaryBuildPhaseReplacement = r'''
53+
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
54+
isa = PBXShellScriptBuildPhase;
55+
alwaysOutOfDate = 1;
56+
buildActionMask = 2147483647;
57+
files = (
58+
);
59+
inputPaths = (
60+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
61+
);
62+
''';
63+
64+
newProjectContents = newProjectContents.replaceAll(thinBinaryBuildPhaseOriginal, thinBinaryBuildPhaseReplacement);
65+
if (originalProjectContents != newProjectContents) {
66+
logger.printStatus('Adding input path to Thin Binary build phase.');
67+
_xcodeProjectInfoFile.writeAsStringSync(newProjectContents);
68+
}
69+
}
70+
}

packages/flutter_tools/templates/app_shared/ios-objc.tmpl/Runner.xcodeproj/project.pbxproj.tmpl

+1
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@
246246
files = (
247247
);
248248
inputPaths = (
249+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
249250
);
250251
name = "Thin Binary";
251252
outputPaths = (

packages/flutter_tools/templates/app_shared/ios-swift.tmpl/Runner.xcodeproj/project.pbxproj.tmpl

+1
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@
229229
files = (
230230
);
231231
inputPaths = (
232+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
232233
);
233234
name = "Thin Binary";
234235
outputPaths = (

packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.xcodeproj.tmpl/project.pbxproj.tmpl

+1
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@
187187
files = (
188188
);
189189
inputPaths = (
190+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
190191
);
191192
name = "Thin Binary";
192193
outputPaths = (

0 commit comments

Comments
 (0)