Skip to content

Instantly share code, notes, and snippets.

@tivac
Created May 12, 2010 18:47
Show Gist options
  • Save tivac/398967 to your computer and use it in GitHub Desktop.
Save tivac/398967 to your computer and use it in GitHub Desktop.
<project name="PhoneGap BlackBerry Ant Build" default="build">
<taskdef resource="bb-ant-defs.xml" />
<!-- PROPERTY DEFINITION - FILL THESE OUT! -->
<!-- rapc and sigtool require the jde.home property to be set -->
<property name="jde.home" location="C:\Program Files (x86)\Eclipse-BlackBerry\plugins\net.rim.ejde.componentpack4.6.1_4.6.1.36\components" />
<!-- Required to launch MDS-CS to allow XHR -->
<property name="mds.home" location="${jde.home}\MDS" />
<!-- directory of simulator to copy files to -->
<property name="simulator.home" location="${jde.home}\simulator\" />
<!-- directory of your phonegap assets (HTML/CSS/JS) - PhoneGap convention is to keep in a folder called 'www'. -->
<!-- defaults to the stock application located under the 'example' dir -->
<property name="www.dir" location="src/www" />
<!-- directory where you want the final binaries to be copied to. -->
<property name="build.dir" location="build" />
<!-- name of the binaries to generate (i.e. <blah>.cod, <blah>.jar, etc.) -->
<property name="cod.name" value="GWID" />
<!-- password for the Signature Tool -->
<property name="password" value="gw1d" />
<!-- name of the application, as it appears in the BlackBerry menu -->
<property name="application.name" value="Guild Wars ID+" />
<target name="build" depends="clean, buildjavascript">
<mkdir dir="${build.dir}" />
<mkdir dir="www" />
<copy todir="www" overwrite="true">
<fileset dir="${www.dir}" />
<!-- copy build phonegap.js -->
<fileset file="phonegap.js" />
</copy>
<rapc output="${cod.name}" generatesourcelist="true" verbose="true">
<src>
<!-- for source to include, just the src folder which includes PhoneGap, and the www dir that the user specified. -->
<fileset dir="src" />
<fileset dir="www" />
</src>
<jdp title="${application.name}" />
</rapc>
<copy todir="${build.dir}">
<fileset dir="" includes="*.cod,*.cso,*.debug,*.jad,*.jar,*.csl,*.rapc" />
</copy>
<delete file="${cod.name}.cod" />
<delete file="${cod.name}.cso" />
<delete file="${cod.name}.debug" />
<delete file="${cod.name}.jad" />
<delete file="${cod.name}.jar" />
<delete dir="www" />
<delete file="phonegap.js" />
</target>
<target name="sign" depends="build">
<sigtool codfile="${build.dir}/${cod.name}.cod" password="${password}" />
</target>
<target name="clean">
<delete dir="${build.dir}" />
</target>
<target name="buildjavascript">
<concat destfile="phonegap.js" append="true">
<fileset dir="../js/">
<include name="*.js" />
</fileset>
</concat>
</target>
<target name="load-simulator" depends="build">
<copy todir="${simulator.home}">
<fileset dir="${build.dir}" includes="*.cod,*.cso,*.debug,*.jad,*.jar,*.csl,*.rapc" />
</copy>
<exec executable="${mds.home}/run.bat" dir="${mds.home}" spawn="true"></exec>
<exec executable="${simulator.home}/defaultSimulator.bat" dir="${simulator.home}" spawn="true"></exec>
</target>
<target name="load-device" depends="sign">
<exec executable="${jde.home}/bin/JavaLoader.exe" dir="." failonerror="true">
<arg value="-u" />
<arg value="load" />
<arg value="${build.dir}/${cod.name}.cod" />
</exec>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment