login | new user? join now!
Mobile
         
 

Categories

» Java
» Symbian
» iPhone
» Android
» Windows Mobile
» Others
» Blackberry RIM
Bookmark and Share

 

How to Create build.xml file for blackberry mobile applications

I am going to describe here how to create a build.xml file using bb-ant-tool and eclipse for blackberry applications.

First download bb-ant-tools and save it in the plugin directory of the eclipse.

Now I am going to describe all parts of build.xml file.

<!—- give project name and target name. This target name will be the entry point of this build file -->

<project name="project_name" default=" run ">

<!—- path of jde home directory and jde signature file home directory sometimes both are different suppose your signature tool is register for 4.2 and you are using jde 4,.5 for development -->

<property name="jde.home.45" location="C:\\eclipse-SDK-3.4.2-win32\\eclipse\\plugins\\net.rim.eide.componentpack4.5.0_4.5.0.16\\components"/>

<property name="jde.home.sig" location="C:\\eclipse-SDK-3.4.2-win32\\eclipse\\plugins\\net.rim.eide.componentpack4.5.0_4.5.0.16\\components"/>

<property name="blackberry.simulator.path.45" value="C:\\eclipse-SDK-3.4.2-win32\\eclipse\\plugins\\net.rim.eide.componentpack4.5.0_4.5.0.16\\components\\simulator"/>

<!—- here title is for your projects title, vendor is your company name -->

<property name="title" value="name"/>

<property name="vendor" value="company-name"/>

<!—- every time you run this script, it will ask for version no. and will create output folder and file according to that version information -->

<input message="What version are you building?" addproperty="app.version"/>

<property name="output.dir" value="name V${app.version}"/>

<property name="output.file" value="name_V${app.version}"/>

<! -- define the tasks from bb-ant project -->

<taskdef resource="bb-ant-defs.xml" classpath="${bb-ant-tools-jar}"/>

<! -- initialize everything for this process -->       

<target name="init">

<mkdir dir="${output.dir}"/>

<mkdir dir="${output.dir}/unzipped"/>

</target>

<!—- compile all files -->              

                <target name="compile" depends="init">

<!—- for using rapc you have to specify output file name, destdir and jde home if you are using preprocessors in you code file, that you can specify here in the defines etc.

//#preprocessor

//#ifdef OS_4_5

System.out.println(“in using 4.5 os”);

//#elseif

System.out.println(“I am not using a os 4.5”);

//#endif

-->                         

<rapc output="${output.file}" destdir="${output.dir}" jdehome="${jde.home.45}" defines="OS_4_5">

                                                                <src>

                                                                                <fileset dir="src">

                                                                                <include name="**/*.java"/>

                                                                                <include name="**/*.png"/>

                                                                                <include name="**/*.gif"/>

                                                                                </fileset>

                                                                </src>                                                  

                                                <jdp title="${title}" vendor="${vendor}" version="${app.version}" type="cldc" icon="icon.png"/>

                                                </rapc>

                                </target>           

                <! -- sign the COD file -->

 

 

<target name="sign45" depends=" unzip_cod45">

<sigtool password="password" codfile="${output.dir}/${output.file}.cod" jdehome="${jde.home.sig}"/>

</target>

                <! – some times jad file doesn’t contain that you want at that time override the name of the application title in Options/Applicaions -->

 

<target name="jad" depends="sign45">

<jadtool input="${output.dir}/${output.file}.jad" destdir="${output.dir}/unzipped">

                  <fileset dir="${output.dir}" includes="*.cod" />

                  <override key="MIDlet-Name" value="${title}"/>

                  <override key="RIM-COD-Module-Name" value="name_V${app.version}"/> 

</jadtool>

</target>

<target name="unzip_cod45" depends="compile">

<copy file="${output.dir}/${output.file}.cod" tofile="${output.dir}/${output.file}.zip" overwrite="true"/>

<unzip src="${output.dir}/${output.file}.zip" dest="${output.dir}/unzipped" overwrite="true"/>

<delete file="${output.dir.QA}/${output.file}.zip"/>      

                </target>

<! -- run the cod file on simulator -->

                <target name="run" description="Run" depends=" jad ">

                   <exec dir="${blackberry.simulator.path42}" executable="${blackberry.simulator.path}/fledge.exe">

                       <arg line=" /data-port=0x4d44 /data-port=0x4d4e /pin=0x2100000A /app=Jvm.dll" />

                   </exec>

                </target>

</project>

Run this build.xml file and you will find signed unzipped cod and jad files in output.dir/unzipped folder.

 

 

 

Comments:
Post Your Comment
Rate this article
Name
Email
Comment