02-27-2011 10:57 PM
I've gotten tired of trying to remember the command line switches to build and deploy my apps so I'm sharing the ant script I've put together to make this work. I've put this in my fork of the WW tablet sdk on github. I welcome any suggestions or questions.
https://github.com/pnewhook/WebWorks-TabletOS-Cont
<?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="AppName" default="install" basedir="./app">
<description>
Build file for a Blackberry Playbook App
</description>
<!-- Definitely change these -->
<property name="password" value="" />
<property name="simIP" value="" />
<!-- You may need to set this -->
<property name="sdk.HOME" location="C:\Program Files (x86)\Research In Motion\BlackBerry WebWorks Packager for PlayBook" />
<!-- Don't change these! -->
<property name="build.dir" location="${basedir}\build" />
<property name="bar.file" location="${build.dir}\${ant.project.name}.bar" />
<property name="sdk.JAVA_HOME" location="${sdk.HOME}\jre" />
<property name="bbwp.dir" location="${sdk.HOME}\bbwp"/>
<property name="sdkbin.dir" location="${bbwp.dir}\blackberry-tablet-sdk\bin"/>
<property name="bbwp" location="${bbwp.dir}\bbwp.exe" />
<property name="BarDeploy.dir" location="${bbwp.dir}\blackberry-tablet-sdk\lib" />
<target name="init" depends="clean" description="Creates the build.dir folder for your archive and bar file" >
<mkdir dir="${build.dir}"/>
</target>
<target name="zip" depends="init" description="Archive your files before building the bar" >
<zip destfile="${build.dir}/${ant.project.name}.zip"
basedir="${basedir}"
/>
</target>
<target name="bar" depends="zip" description="create the bar file" >
<exec executable="${bbwp}">
<env key="JAVA_HOME" path="${sdk.JAVA_HOME}" />
<arg value="${build.dir}\${ant.project.name}.zip"/>
<arg line="/o ${build.dir}" />
</exec>
</target>
<target name="install" depends="bar" description="Deploy the the .bar file to your simulator. The old application is automatically uninstalled." >
<java jar="${BarDeploy.dir}/BarDeploy.jar"
fork="true"
maxmemory="512M"
>
<env key="JAVA_HOME" path="${sdk.JAVA_HOME}" />
<arg value="-installApp" />
<arg value="-password" />
<arg value="${password}" />
<arg value="-device" />
<arg value="${simIP}" />
<arg value="-package" />
<arg value="${bar.file}" />
</java>
</target>
<target name="uninstall" description="Uninstall an application from the Simulator. " >
<java jar="${BarDeploy.dir}/BarDeploy.jar"
fork="true"
maxmemory="512M"
>
<env key="JAVA_HOME" path="${sdk.JAVA_HOME}" />
<arg value="-uninstallApp" />
<arg value="-password" />
<arg value="${password}" />
<arg value="-device" />
<arg value="${simIP}" />
<arg value="-package" />
<arg value="${bar.file}" />
</java>
</target>
<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>
02-28-2011 02:51 AM
I will try the script.
THANKS !!
02-28-2011 12:03 PM
Thanks so much for sharing. I am going to try and tweak it a bit to work on a Mac and remove those pesky .DS_Store files that invalidate RIM's build tool.
02-28-2011 12:37 PM
I also have a Blog article that should be posted any day now that shows what I do from an old school Windows batch file for those that aren't familiar with ANT ![]()
02-28-2011 07:50 PM
@Berryreview I'd love to see your revisions to add support for Mac, that's just an area I don't have any expertise. AsI mention in the repo I put the application in the App folder because some of my tools,(VS, eclipse) like putting files in the root directory, and they got in the way. Feel free to fork my repo then I can merge it.
02-28-2011 08:00 PM
Tim any chance we can get RIM to setup a repository with these sorts of scripts like Ant scripts. I have a few developers that might be willing to share them but its a bit crazy to have each developer have to create them on their own...
02-28-2011 08:11 PM
+1 for sharing build tools. While I'm curious how you would use a batch file, I'm sure the Mac developers are looking for something a little more cross platform.
03-01-2011 11:41 AM
The Batch scripts that I use are now up in my blog post that finally went live ![]()
http://devblog.blackberry.com/2011/03/blackberry-w
For ant scripts or other utilities that can help developers, we now have our contributor's agreement in place for our WebWorks open source project as well as the PlayBook source code.
If you have helpful scripts that can aid the commuity I definately encourage you to contribute them to the project.
03-01-2011 11:56 AM - edited 03-01-2011 11:59 AM
You mean a batch file like this :
SET ip=192.168.1.128 SET name=MyApp SET password=aaaaaa SET installDir="C:\rim\playbook\BlackBerry WebWorks Packager for PlayBook\bbwp" zip -0 -r %name%.zip * -x .* *.exe *.bar *.zip *.bat %installDir%\bbwp %name%.zip /o ./ %installDir%\blackberry-tablet-sdk\bin\blackberry-deploy -installApp -password %password% -device %ip% -devMode -package %name%.bar
PS I just noticed your reply Tim, but I think my batch file is better.
03-01-2011 12:01 PM
pnewhook wrote:
+1 for sharing build tools. While I'm curious how you would use a batch file, I'm sure the Mac developers are looking for something a little more cross platform.
Writting something similar with sh or bash would not be to hard, but its been to long since I wrote a shellscript that did what I wanted it to do.