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

99 Views Asked by At

I am using Ant to get bundle number from an iOS app. Related script is in following:

 <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>

I can see the correct result from exec. But message from echo was always 0. I feel that PlistBuddy->Print did not set result to the resultproperty. Am I right? If so how it can be done?

Thanks in advance.

1

There are 1 best solutions below

0
JohnnL On BEST ANSWER

Actually I just found an answer - use outputproperty instead of resultproperty. It works after that.