Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

BlackBerry Development: Using Apache Ant


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


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.