> On 19 Aug 2020, at 11:47 am, Gabriel Zachmann via Cocoa-dev 
> <cocoa-dev@lists.apple.com> wrote:
> 
> I tried this:
> 
>  plutil -replace CFBundleVersion -string '$(CURRENT_PROJECT_VERSION) 111' 
> qq.plist
> 
> which works -- but what I need to do is something like this:
> 
>  plutil -replace CFBundleVersion -string "\$(CURRENT_PROJECT_VERSION) 
> $build_number" qq.plist

You've changed the escaping and quoting between these two invocations, which 
surely accounts for the difference in behaviour. This should work:

> plutil -replace CFBundleVersion -string "$CURRENT_PROJECT_VERSION 
> $build_number" qq.plist

Bash (which I presume you're invoking the script with) interprets parentheses 
differently from the Xcode preprocessor; it runs the contained string as a 
command and substitutes the output. The build system exports all the build 
settings to the environment, so `CURRENT_PROJECT_VERSION` ends up being as much 
a shell variable as `build_number`.

All that said, by doing this you're going to end up with an ill-formatted 
CFBundleVersion. Per 
https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102364
 :

> The build version number should be a string comprised of three non-negative, 
> period-separated integers with the first integer being greater than zero—for 
> example, 3.1.2. The string should only contain numeric (0-9) and period (.) 
> characters. 

The space breaks this. If you need a compound identifier like this, put it in a 
custom key in the Info.plist.

-ben

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to