Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Developer
pnewhook
Posts: 70
Registered: ‎01-13-2011
My Device: Torch 9800 and Playbook

Sample Ant Build Script for Playbook WebWorks

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

 

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

 

 

Please use plain text.
Regular Contributor
Cesar_Vanatur
Posts: 76
Registered: ‎02-17-2010
My Device: Storm

Re: Sample Ant Build Script for Playbook WebWorks

 

I will try the script.

 

THANKS !!

Please use plain text.
Contributor
Berryreview
Posts: 17
Registered: ‎01-09-2011
My Device: Not Specified

Re: Sample Ant Build Script for Playbook WebWorks

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.

Please use plain text.
Retired
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Sample Ant Build Script for Playbook WebWorks

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 :smileyhappy:

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
New Developer
pnewhook
Posts: 70
Registered: ‎01-13-2011
My Device: Torch 9800 and Playbook

Re: Sample Ant Build Script for Playbook WebWorks

@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.

Please use plain text.
Contributor
Berryreview
Posts: 17
Registered: ‎01-09-2011
My Device: Not Specified

Re: Sample Ant Build Script for Playbook WebWorks

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

Please use plain text.
New Developer
pnewhook
Posts: 70
Registered: ‎01-13-2011
My Device: Torch 9800 and Playbook

Re: Sample Ant Build Script for Playbook WebWorks

+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.

Please use plain text.
Retired
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Sample Ant Build Script for Playbook WebWorks

The Batch scripts that I use are now up in my blog post that finally went live :smileyhappy:

 

http://devblog.blackberry.com/2011/03/blackberry-webworks-sdk-for-tablet-os-tips/

 

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.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Developer
haagmm
Posts: 178
Registered: ‎07-29-2008
My Device: Not Specified

Re: Sample Ant Build Script for Playbook WebWorks

[ Edited ]

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.

 

Please use plain text.
Developer
haagmm
Posts: 178
Registered: ‎07-29-2008
My Device: Not Specified

Re: Sample Ant Build Script for Playbook WebWorks

 


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.

 

Please use plain text.