Skip to content

Instantly share code, notes, and snippets.

@tjboudreaux
Created November 21, 2011 14:47
Show Gist options
  • Save tjboudreaux/1382814 to your computer and use it in GitHub Desktop.
Save tjboudreaux/1382814 to your computer and use it in GitHub Desktop.
Snippet: Blackberry Webworks App Build Ant File
<?xml version="1.0" encoding="utf-8" ?>
<!--
Name should have no spaces and be only alpha characters.
The project name will be used to generate your .zip archive and .bar file
-->
<project name="Webworks App" default="builddeploy" basedir=".">
<description>
Build file for a Blackberry Webworks API App
</description>
<!-- You may need to set this -->
<property name="sdk.HOME" location="/Developer/SDKs/Research In Motion/BlackBerry WebWorks SDK 2.2.0.15" />
<!-- Don't change these! -->
<property name="build.dir" location="${basedir}/build" />
<property name="ota.dir" location="${build.dir}/OTAInstall" />
<property name="sdk.JAVA_HOME" location="${sdk.HOME}/jre" />
<property name="bbwp.dir" location="${sdk.HOME}"/>
<property name="bbwp" location="${bbwp.dir}/bbwp" />
<taskdef name="jslint"
classname="com.googlecode.jslint4java.ant.JSLintTask"
classpath="/usr/share/ant/lib/jslint4java-2.0.1.jar" />
<target name="lint">
<jslint>
<formatter type="plain" />
<fileset dir="./scripts/entities" includes="*.js" />
</jslint>
</target>
<!-- Increment the build number -->
<target name="increment">
<propertyfile file="build.properties">
<entry key="version.build" type="int" operation="+" default="0"/>
</propertyfile>
<property file="build.properties"/>
<echo message="Build number is ${version.major}.${version.minor}.${version.build}"/>
<replaceregexp file="config.xml" match='version="(\d+\.)(\d+\.)(\*|\d+)"' replace='version="${version.major}.${version.minor}.${version.build}"' />
<replaceregexp file="about/index.html" match='Version: (\d+\.)(\d+\.)(\*|\d+)' replace='Version: ${version.major}.${version.minor}.${version.build}' />
</target>
<!-- -->
<target name="init" depends="clean, increment" description="Creates the build.dir folder for your archive and bar file" >
<mkdir dir="${build.dir}"/>
</target>
<!-- Zip the application before building it -->
<target name="zip" depends="init" description="Archive your files before building" >
<zip destfile="${build.dir}/${ant.project.name}.zip"
basedir="${basedir}"
/>
</target>
<!-- Compile the blackberry application -->
<target name="build" depends="zip" description="create the build files" >
<exec executable="${bbwp}">
<env key="JAVA_HOME" path="${sdk.JAVA_HOME}" />
<arg value="${build.dir}/${ant.project.name}.zip"/>
<arg line="-o ${build.dir}" />
<arg line="-g ${signing_key_password}" />
</exec>
</target>
<!-- deploy OTA installable to endpoint url for tester's to download the app -->
<target name="deploy" description="deploy to new server">
<exec executable="bash" failonerror="true">
<arg value="./deploy.sh" />
</exec>
</target>
<target name="builddeploy" depends="build,deploy" />
<target name="clean" description="clean up" >
<!-- Delete the ${build.dir} directory -->
<!-- This is performed before every install because you want a fresh archive -->
<delete dir="${build.dir}"/>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment