首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当从ant调用时,PListBuddy失败

当从ant调用时,PListBuddy失败
EN

Stack Overflow用户
提问于 2011-09-22 01:03:50
回答 1查看 1.4K关注 0票数 1

我有一个构建脚本,它从iOs产品的plist中取出旧版本,输出它,然后更新plist。这两个命令是

代码语言:javascript
复制
/usr/libexec/PlistBuddy -c Print CFBundleVersion ${LocationOfPList}
/usr/libexec/PlistBuddy -c Set :CFBundleVersion ${Version} ${LocationOfPList}

从命令行运行(使用版本和正确的PList文件位置),一切都很好。从ant运行为

代码语言:javascript
复制
<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脚本以与命令行示例相同的用户身份运行。我看到的输出是:

代码语言:javascript
复制
[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

plist没有更新,唯一命中的是返回码1。我是发布工程师-我不知道xcode。有没有人看到我做错了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-09-22 01:19:08

在set命令中,在plist位置之前有一个前导空格:

代码语言:javascript
复制
 <!--        v -->
 <arg value=" ${LocationOfPList}"/>

这是那些看不见的错误之一-您可能会注意到错误消息中"Will Create:“和"/Users”之间的两个空格。去掉空格,它就可以工作了。

此外,第一个exec将PListError属性设置为空字符串,并且Ant属性是不可变的,因此第二个exec没有错误文本。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7503724

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档