PlistBuddy command fallbacks for builds - #580
Open
sushidub wants to merge 3 commits into
Open
Conversation
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.
What
Replaces assertive external cli commands (existing within custom build file) with conditionals and failure (nonzero exit codes) fallbacks.
Where
Last two lines of the
Update Build Numbershell scriptTools/update_build_number.shWhy
To avoid potential build failures due to breaking changes in and/or rando updates to users version of PlistBuddy.
Issue Context
From what I'm able to grok from source, build execution (via Xcode IDE) contains a
Run script build phasein which the custom bash script (e.g.,Update Build Number) is invoked. The last three lines of that file contain command calls to users local version of PlistBuddy (located/usr/libexec/PlistBuddy).For reasons that I'm blissfully ignorant/unaware of, my Xcode (v26.6) builds fail at the last two (of the three) lines being executed against PlistBuddy.
Debugging & Tests
Manual PlistBuddy tests in separate shell using same two line assertions as in file
Confirm Info.plist and file content
$ cd <xcode's tmp build dir>plistcontent exists only for the commands leading up to build failureTo test for issues associated with local version of PlistBuddy, we'll copy the last two commands within the
Tools/update_build_number.shinto separate shell and run them separately from command line.Note that the Xcode build process is not containerized (at least it isn't on my machine), so both commands are invoking my local version of PlistBuddy just as its invoked during Xcode
Run script build phase.Info.plista preexisting key/value item.since return value is a
non zero exitcode(e.g.Add: ":CFBundleBuildVersion" Entry Already Exists) this would result in Xcode build failInfo.plistwhere key does not exist.this would also result in build fail since the return value is
non zero exitcode(e.g.Set: Entry, ":CFBundleShortVersionString", Does Not Exist)Info.plistgive it a value of ..., otherwise add the key to the plist file with a type assignment ofstringand a value of ...Build passes since the return value is 0
NOTE: Its not obvious in the above tests, but if the
Setsubcommand contains a type declaration (e.g. 'string') as is the requirement for theAddsubcommand, the resulting string value will include that type declaration as a prepended string to the overall value output. Avoid this.For obvious reasons its not realistic to expect external tooling to execute with the same test and results precision throughout update cycles - let alone variations that might make it into future OS release.