Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ant 在Worklight上自动增加应用程序版本_Ant_Ibm Mobilefirst - Fatal编程技术网

Ant 在Worklight上自动增加应用程序版本

Ant 在Worklight上自动增加应用程序版本,ant,ibm-mobilefirst,Ant,Ibm Mobilefirst,我们正在使用WL Enterprise 6.2.0.1版开发WL项目,文件(原生[ipa/apk]和混合[wlapp])的构建使用ANT脚本完成 是否有一种方法可以在构建过程中自动增加内部的应用程序版本(applicationdescriptor.xml) 是否有一个脚本可用于完成此任务?方法稍有不同,但此示例(读取“原样”)代码应提供足够的信息,以创建自己的ANT目标来执行此任务: <!-- ================================================

我们正在使用WL Enterprise 6.2.0.1版开发WL项目,文件(原生[ipa/apk]和混合[wlapp])的构建使用ANT脚本完成

是否有一种方法可以在构建过程中自动增加内部的应用程序版本(applicationdescriptor.xml)


是否有一个脚本可用于完成此任务?

方法稍有不同,但此示例(读取“原样”)代码应提供足够的信息,以创建自己的ANT目标来执行此任务:

<!-- =========================================================================== -->
<!-- Target: -update-build-number                                                -->
<!-- =========================================================================== -->
<target name="-update-build-number">
    <if>
        <isset property="${prop.buildNmber}" />
        <then>
            <property name="buildNumber" value="${prop.buildNmber}" />
        </then>
        <else>
            <tstamp>
                <format property="buildNumber" pattern="${prop.buildNumberPattern}" />
            </tstamp>
        </else>
    </if>

    <echo message="Setting application build Number : ${buildNumber}"   />

    <if>
        <istrue value="${prop.env.android}"   />
        <then>
            <echo message="Updating Android build number"   />
            <replaceregexp file="${appdir}/android/nativeResources/AndroidManifest.xml"
                           match='(android:versionCode=").*(" .*$)'
                           replace='\1${buildNumber}\2'
                           byline="true" />
        </then>
    </if>
    <if>
        <istrue value="${prop.env.ipad}"   />
        <then>
            <echo message="Updating IPad build number"   />
            <exec executable="/usr/libexec/PlistBuddy">
                <arg value="-c"/>
                  <arg value="Set CFBundleVersion ${buildNumber}" />
                  <arg value="${appdir}/ipad/native/${prop.iosNativePrefix}${prop.appName}Ipad-Info.plist"/>
            </exec>
        </then>
    </if>
    <if>
        <istrue value="${prop.env.iphone}"   />
        <then>
            <echo message="Updating IPhone build number"   />
            <exec executable="/usr/libexec/PlistBuddy">
                <arg value="-c"/>
                  <arg value="Set CFBundleVersion ${buildNumber}" />
                  <arg value="${appdir}/iphone/native/${prop.iosNativePrefix}${prop.appName}Iphone-Info.plist"/>
            </exec>
        </then>
    </if>
    <antcall target="-update-build-number-custom"  />
</target>


它需要使用ant contrib。

谢谢,我会试试。