FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Mobility
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
September 29, 2004

BlackBerry Development: Using Apache Ant

(Page 4 of 5)
<!-- Preverify the compiled code --> <target name="javacompile"> <wtkbuild srcdir="${src}" destdir="${unpreverified.classes}" bootclasspath="${net_rim_api.jar}"/> </target>

<!-- Preverify the compiled code --> <target name="preverify" depends="javacompile"> <wtkpreverify srcdir="${unpreverified.classes}" destdir="${final.classes}" classpath="${net_rim_api.jar}"/> </target>

<!-- Version the JAD and MANIFEST Files --> <target name="version" depends="preverify"> <!-- Version the MANIFEST --> <filter token="buildVer" value="${ver}" /> <filter token="midletName" value="${name}" /> <copy file="${manifest.template}" tofile="${manifestfile}" filtering="true" overwrite="true" />

<!-- Version the JAD file --> <filter token="buildVer" value="${ver}" /> <filter token="midletName" value="${name}" /> <filter token="jarName" value="${name}.jar" /> <copy file="${jad.template}" tofile="${jadfile}" filtering="true" overwrite="true" /> </target>

<!-- Package (JAR) the compiled classes. This also modifies the JAD file with JAR size information --> <target name="package" depends="version"> <delete dir="${final.classes}/META-INF" /> <wtkpackage jarfile="${final.jar}" jadfile="${jadfile}"> <fileset dir="${final.classes}"/> <fileset dir="${resources}"/> </wtkpackage> </target>

<!-- Invoke the RAPC compiler. This step is based the RAPC's usage: rapc.exe import=RIM_APIs codename=Codename JAD-File JAR-File --> <target name="rapc" depends="package" description="RIM COD Compiler"> <exec dir="." executable="${bbjdebuild.jars}/rapc.exe"> <arg line=" import=${net_rim_api.jar} "/> <arg line=" codename=${codename} "/> <arg line=" ${jadfile} "/> <arg line=" ${jarfile} "/> </exec> </target>

<!-- Once the COD file has been generated, move generated file to output directory --> <target name="build" depends="rapc"> <move file="${codename}.cod" tofile="output/tocod/${codename}.cod"/> <move file="${codename}.debug" tofile="output/tocod/${codename}.debug"/> <move file="${codename}.cso" tofile="output/tocod/${codename}.cso"/> <copy file="${codename}.alx" tofile="output/tocod/${codename}.alx"/> <copy file="${jadfile}" tofile="output/tocod/${codename}.jad"/> </target>

</project>

If you look at the rapc Ant target task in Listing 3, you will see it was written based on the RAPC compiler usage format. But please note that starting with Antenna version 0.9.13, support for RAPC compilation (contributed by me) is now available. To use the new RACP Ant support first download the latest version of Antenna, then add to your build.xml script the following task definition, similarly to how we defined the rest of the Antenna Ant tasks:

<taskdef name="wtkrapc" classname="de.pleumann.antenna.WtkRapc" classpath="${build.jars}/${antenna.jar}"/>

The following snippet shows how to use the new Antenna RACP task (feel free to replace the racp target in Listing 3 with the following code snippet). For more information please refer to the Antenna Javadoc:

<target name="rapc" description="RIM COD Compiler" depends="package">
    <wtkrapc
    	quiet="true"      	
    	midlet="false" 
    	jadfile="${jadfile}" 
    	source="${jarfile}" 
    	codename="${codename}" 
     	import="${bb.api.jar}" 
    	destdir="output/tocod/"/>
</target>

Previous Page | 1 | 2 | 3 | 4 | 5 Next Page
RELATED ARTICLES
No Related Articles
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK