Settle iOS read and write semantics - #27
Merged
friederbluemle merged 2 commits intoSep 4, 2026
Merged
Conversation
getIOSVersions returned the first MARKETING_VERSION and CURRENT_PROJECT_VERSION in project.pbxproj, while getIOSAppId already resolved the application target's build configuration. Xcode sorts XCBuildConfiguration objects by id, so "first" was arbitrary: in the stock React Native template the test target's configurations come before the app's, and --print-env ios combined the app id of one configuration with the versions of another target. All three iOS values now come from the application target's configuration named by --configuration, which applies to every --print* flag for ios instead of only the ones involving the app id. A setting missing from the target's configuration falls back to the project-level configuration of the same name, as Xcode does, so projects that keep their versions at the project level keep working. The test fixture gained a PBXProject object with its own configuration list to cover that path.
A build.gradle without versionName / versionCode or a project.pbxproj without MARKETING_VERSION / CURRENT_PROJECT_VERSION (for example an older project that keeps literal values in Info.plist) was reported as synced although nothing was written. Both updaters now throw the same "No X found" error as the readers, so the sync fails instead of pretending. The README also states why iOS writes touch every target: Xcode requires extensions to carry the same version as their app.
Contributor
|
🎉 Released in v0.7.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The iOS reads were inconsistent with each other and with the writes.
getIOSAppIdresolves the application target's build configuration, butgetIOSVersionstook the firstMARKETING_VERSION/CURRENT_PROJECT_VERSIONin the file. Xcode sortsXCBuildConfigurationobjects by id, so "first" is arbitrary: in the stock React Native template the test target's configurations sort before the app's, and--print-env ioscombined the app id of one configuration with the versions of another target. Meanwhile the write side replaced every occurrence without saying so, and silently did nothing when there were none.Settled semantics, one commit each:
MARKETING_VERSION,CURRENT_PROJECT_VERSIONandPRODUCT_BUNDLE_IDENTIFIERall come from the application target's build configuration named by--configuration(defaultRelease), which now applies to every--print*flag for ios rather than only the app-id ones. A setting missing from the target's configuration falls back to the project-level configuration of the same name, as Xcode resolves it, so projects that keep versions at the project level keep working. A value that is a build setting variable is rejected for versions too, not only for the app id. xcconfig files are still not read.MARKETING_VERSIONandCURRENT_PROJECT_VERSIONin the file; that is intentional and now documented, since Xcode requires extensions to carry the same version as their containing app. Aproject.pbxprojwithout those settings, or abuild.gradlewithoutversionName/versionCode, was reported as synced although nothing was written; both updaters now fail with the same "No X found" error the readers use.The test fixture emits a
PBXProjectobject with its own configuration list (matching Xcode's layout) so the fallback path is covered, and build configurations can omit version settings to test the failure cases.One limitation stays: a project with several application targets can no longer read iOS versions, because there is no way to say which target.
--print-app-idalready had that restriction. A--targetoption would lift it if the need comes up.Reading versions from a different target than before is a behavior change, so this should go out as a minor release.