Repository navigation
Reevaluate getting and parsing of iOS/macOS build settings #134669
Description
Activity
- addedplatform-iosiOS applications specificallyiOS applications specificallytoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.P2Important issues not at the top of the work listImportant issues not at the top of the work listc: tech-debtTechnical debt, code quality, testing, etc.Technical debt, code quality, testing, etc.team-iosOwned by iOS platform teamOwned by iOS platform team
on Sep 13, 2023 - addedtriaged-iosTriaged by iOS platform teamTriaged by iOS platform team
on Sep 18, 2023 Adding a data point on this with Xcode 26 + SWBBuildService, where the performance of
xcodebuild -showBuildSettingsonPods.xcodeprojhas regressed significantly on large projects.Reproduction
- Xcode 26.4.1 (Build 17E202) — stable
- macOS 26 (Apple Silicon)
- Flutter 3.35.4
- Production Flutter project with 122 CocoaPods targets (Firebase, GoogleMaps, OneSignal, etc.)
Measurement
Timings from a
flutter run --verbose --flavor developmentagainst a booted iPhone 16e simulator:Phase Duration Runner.xcodeproj -showBuildSettings(generic/iOS + iphonesimulator)~11s Pods.xcodeproj -alltargets -showBuildSettings~208s Actual xcodebuildcompile (122 pods + app)~159s rsync app to simulator + simctl install~51s Total wall clock to first frame ~432s (~7m12s) So
pluginsBuildSettingsOutput(called viapluginsSupportArmSimulator()inxcode_project.dart) is the single largest contributor toflutter runtime — ~48% of the total wall clock. This runs on everyflutter run, not just afterpod install.Root cause observation
On Xcode 26, SWBBuildService opens a fresh build graph per pod target when
-alltargetsis passed. With 122 targets that's ~1.7s/target on this machine, totaling ~208s. On Xcode 16.x the same project's-alltargetsquery completed in ~30s, so this looks like a regression tied to SWBBuildService's per-target graph initialization cost rather than the historicaldeveloperservices2.apple.comnetwork delay (which was fixed in Xcode 26.0).Functional result
The check exists to decide whether to append
arm64toEXCLUDED_ARCHSfor the simulator. On this project, no pod excludes arm64 (verified by grepping the captured-showBuildSettingsoutput andPods.xcodeproj/project.pbxprojforEXCLUDED_ARCHS.*arm64— zero matches), so the 208s is spent to produce a result the build would have produced anyway.Workaround (local patch)
I patched
xcode_project.dartlocally to cache the result ofpluginsSupportArmSimulator()atbuild/ios/.arm64_sim_support_cachekeyed offPodfile.lock's mtime. Cache invalidates onpod install(Podfile.lock rewrite) and onflutter clean(build dir cleared). After the first run seeds the cache,Running Xcode build...now starts at ~13s instead of ~222s — a ~209s saving per run. Fullflutter runwall clock dropped from ~432s to ~225s.Happy to turn this into a PR if a Podfile.lock-keyed disk cache is an acceptable approach. An alternative would be to avoid the
xcodebuildinvocation entirely by reading the relevant build settings directly from thexcconfigfiles CocoaPods writes.
We use
xcodebuild -showBuildSettingsto get the build settings for iOS and macOS projects.flutter/packages/flutter_tools/lib/src/ios/xcodeproj.dart
Lines 175 to 244 in adaf78a
However, there appears to be some potential problems with this functionality:
-targetand-schemeare used, it will errorFor example, if you set two targets to

Runfor the schemeAnd then did
xcodebuild -project xxx -configuration xxx -scheme Runner -showBuildSettings, it would show something like:This has caused uncertainty in what to use, as seen in #134571 (comment).
We should make this functionality safer and easier to use.