Ant 脚本 - 如何从 plist 文件打印一些文本并将其分配给 属性

Ant script - how can I print some text from plist file and assign it to a property

我正在使用 Ant 从 iOS 应用程序获取捆绑包编号。相关脚本如下:

 <macrodef name="get_build_property">
        <attribute name="info-plist"/>
        <sequential>
            <exec executable="/usr/libexec/PlistBuddy"     
            resultproperty="app.version.bundle.number" 
            failonerror="false">
                <arg value="-c"/>
                <arg value ="Print :CFBundleVersion"/>
                <arg value="@{info-plist}"/>

            </exec>
            <echo message="app.version.bundle.number: ${app.version.bundle.number}" />
        </sequential>
</macrodef>

我可以从 exec 中看到正确的结果。但是来自echo的消息总是0。我觉得PlistBuddy->Print没有将结果设置为resultproperty。我对吗?如果是这样怎么办?

提前致谢。

实际上我刚刚找到了答案 - 使用 outputproperty 而不是 resultproperty。之后就可以了。