我有一个构建脚本,它从iOs产品的plist中取出旧版本,输出它,然后更新plist。这两个命令是
/usr/libexec/PlistBuddy -c Print CFBundleVersion ${LocationOfPList}
/usr/libexec/PlistBuddy -c Set :CFBundleVersion ${Version} ${LocationOfPList}从命令行运行(使用版本和正确的PList文件位置),一切都很好。从ant运行为
<exec 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}" /> 会导致一些奇怪的行为。第一个命令有效,第二个命令失败。此ant脚本以与命令行示例相同的用户身份运行。我看到的输出是:
[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: anttestplist没有更新,唯一命中的是返回码1。我是发布工程师-我不知道xcode。有没有人看到我做错了什么?
发布于 2011-09-22 01:19:08
在set命令中,在plist位置之前有一个前导空格:
<!-- v -->
<arg value=" ${LocationOfPList}"/>这是那些看不见的错误之一-您可能会注意到错误消息中"Will Create:“和"/Users”之间的两个空格。去掉空格,它就可以工作了。
此外,第一个exec将PListError属性设置为空字符串,并且Ant属性是不可变的,因此第二个exec没有错误文本。
https://stackoverflow.com/questions/7503724
复制相似问题