开发者

PListBuddy Fails When Called From ant

I have a build script that pulls the old version out of the plist for an iOs product, outputs it, then updates the plist. The two commands are

/usr/libexec/PlistBuddy -c Print CFBundleVersion ${LocationOfPList}
/usr/libexec/PlistBuddy -c Set :CFBundleVersion ${Version} ${LocationOfPList}

Run from the command line (with the version and the proper PList file location), everything is fine. Run from ant as

<ex开发者_JS百科ec executable="/usr/libexec/PlistBuddy" 
  outputproperty="CurrentVersion"
  errorproperty="PListError">
  <arg value="-c"/>
  <arg value ="Print :CFBundleVersion"/>
  <arg value="${LocationOfPList}"/>
</exec> 

<echo message="Fetched the last version in the plist: ${CurrentVersion}" />

<!-- Set the plist to the current build number -->
<exec executable="/usr/libexec/PlistBuddy"
  outputproperty="PListOutput"
  errorproperty="PListError"
>       
  <arg value="-c"/>
  <arg value ="Set :CFBundleVersion ${Version}" />              
  <arg value=" ${LocationOfPList}"/>
</exec>

<echo message="Output: ${PListOutput}"/>
<echo message="Errors: ${PListError}"/>
<echo message="Old version number: ${CurrentVersion} New Version Number: ${Version}" /> 

Results in some strange behavior. The first command works, the second fails. This ant script is running as the same user as the command line example. The output I see is:

[echo] Fetched the last version in the plist: 3.0.0
[exec] Result: 1
[echo] Output: File Doesn't Exist, Will Create:  /Users/macbuild/iPhone/branches/anttest/iChime/Program-Info.plist
[echo] Errors: 
[echo] Old version number: 3.0.0 New Version Number: anttest

The plist isn't updated, and the only hit is a return code of 1. I'm the release engineer - I don't know xcode. Does anyone see what I'm doing wrong here?


You've got a leading space just before the plist location in the set command:

 <!--        v -->
 <arg value=" ${LocationOfPList}"/>

It's one of those invisible errors - you might notice two spaces between "Will Create:" and "/Users" in the error message. Remove the space and it should work.

Also, the PListError property is set to an empty string by the first exec, and Ant properties are immutable, hence no error text for the second exec.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜