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

Re: Sample Ant Build Script for Playbook WebWorks

@haagmm That's a clean looking script!

 

also,  I've found that when you have JAVA_HOME pointing to a JDK (as many Java devs do) you need to point JAVA_HOME to the JRE distributed with the WebWorks sdk for bbwp.exe to work. That's been my experience on windows 7 64-bit

Developer
haagmm
Posts: 178
Registered: ‎07-29-2008
My Device: Not Specified

Re: Sample Ant Build Script for Playbook WebWorks

 


pnewhook wrote:

@haagmm That's a clean looking script!

 

also,  I've found that when you have JAVA_HOME pointing to a JDK (as many Java devs do) you need to point JAVA_HOME to the JRE distributed with the WebWorks sdk for bbwp.exe to work. That's been my experience on windows 7 64-bit


Ohh good call.  I'm not a J2SE/J2EE dev, just J2ME so I don't have that issue. 

 

 

Just add a "SET JAVA_HOME %installDir%/../jre/bin" to the front right?

Developer
haagmm
Posts: 178
Registered: ‎07-29-2008
My Device: Not Specified

Re: Sample Ant Build Script for Playbook WebWorks

Hey I posted an update to github  here : https://github.com/muerl/WebWorks-TabletOS-Contrib/blob/master/tools/batch/PackageAndDeploy.bat

 

Let me know if that makes sense for your issue.

New Contributor
jsmale
Posts: 3
Registered: ‎03-07-2011
My Device: Not Specified

Re: Sample Ant Build Script for Playbook WebWorks

I'm currently developing an app on my MAC and have developed a shell script which is very similar to the ANT script.

 

 

#! /bin/sh

# Playbook details
ip="192.168.51.128"
password="Passw0rd"

# filename
name="appName"

# path for libraries
pathtobbwp="/Library/Blackberry/WebWorksSDK/bbwp"
pathtobin="/Library/Blackberry/WebWorksSDK/bbwp/blackberry-tablet-sdk/bin"
pathtoapp="/Users/Jason/Documents/Dev/Blackberry/app"

# Clean up things
rm -rf $pathtoapp/bin
rm $pathtoapp/$name.zip
cd $pathtoapp
find . -name .DS_Store -delete

# Create a zip
zip -r $name.zip *

# Compile the ZIP to a bar
cd $pathtobbwp
./bbwp $pathtoapp/$name.zip

# Deploy app to Playbook
cd $pathtobin
./blackberry-deploy -installApp -password $password -device $ip -package $pathtoapp/bin/$name.bar

 

 

I have placed the script 1 folder up from my app, so all I do is navigate to the folder in terminal and run:

 

 

sh compile.sh

 

 

Seems to be working well and saving SO much time, but any improvements would be greatly appreciated.

Contributor
Berryreview
Posts: 17
Registered: ‎01-09-2011
My Device: Not Specified

Re: Sample Ant Build Script for Playbook WebWorks

Maybe somehow throw in the option to run the signing tool?

./bbwp PATHTOZIP /gcsk SETPASSWORD /gp12 SECONDPASSWORD /buildId 0.1

 

You have to love how the documentation writers still have not mentioned that you need to put a ./ before the commands. The other thing that drove me nutz was the two conflicting RIM guides on how to setup code signing. Its like they write this stuff for themselves. They make statements like this:

 

The following command creates a Developer Certificate in the p12 file named output_file.p12. The password you specify in the -storepass

parameter allows you to access the p12 file. You should protect the p12 file and its password.

 

That leave you wondering what the hell a p12 file is...

Contributor
totem
Posts: 37
Registered: ‎03-10-2011
My Device: Not Specified

Re: Sample Ant Build Script for Playbook WebWorks

  Along these lines, is there a command to automatically run the app once successfully deployed?  it will cut a couple of seconds from my workflow  :-)

 

thanks

Developer
haagmm
Posts: 178
Registered: ‎07-29-2008
My Device: Not Specified

Re: Sample Ant Build Script for Playbook WebWorks

They slightly changed the syntax of this in this week's build.  For those of you keeping score at home it is now

 

 

%installDir%\bbwp %name%.zip -o ./

 

Update going to Github soon.

 

New Developer
redbutt
Posts: 37
Registered: ‎03-02-2009
My Device: Bold 9700

Re: Sample Ant Build Script for Playbook WebWorks

There's lots of responses here...but I figure one more variation can't hurt for those interested.  I'm also using ant.  I started with the ant script that launched this thread and updated it.  I've set up my targets such that I use a command like this:

 

ant -f build_webworks.xml build_deploy_unsigned -DtargetIP 169.254.239.161 -Dpassword ******

 

This will build and deploy to the target IP.  I have a similar one set up to also sign the app.

 

ant -f build_webworks.xml build_deploy_signed -DtargetIP 169.254.239.161 -Dpassword ******

 

For the signed version, the signing key params are built into the ant target:

 

 

<target name="bar_signed" depends="zip" description="create the bar file and sign it for actual deployment" >
        <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="-v" />
      <arg line="-gcsk ********" />
      <arg line="-gp12 ********" />
      <arg line="-buildId ${buildVersion}" />
        </exec>
    </target>

 

 

 

Developer
interfaSys
Posts: 817
Registered: ‎11-19-2009
My Device: Z10, Q10, 9900, 9790, PlayBook,

Re: Sample Ant Build Script for Playbook WebWorks

[ Edited ]

Here is a batch script I wrote for rapid deployment :-).

Usage: playbook.prepare.bat srcpath zipname destpath operation

The last argument, called "operation" can be either compile, sign, install or uninstall.

You can easily make modifications if you want "install" to "zip", "compile" and "install" instead of just "install". I wanted an extra step.

 

You'll need to change the variables at the top and to add your zipping command since people seem to use different apps for that...

 

 

:: Copyright 2011 interfaSys Ltd, London, UK
::
:: playbook.prepare.bat
:: Usage: playbook.prepare.bat srcpath zipname destpath operation

@ECHO OFF

:: Replace the following variables with your own values
SET sdkpath=C:\Users\<USERNAME>\SDK\WebworksSDK\bbwp\
SET csk=1111111111111111111111111111111111111111111
SET p12=2222222222222222222222222222222222222222222
SET ip=192.168.22.22
SET devpass=abcd

GOTO CASE_%4%
:case_compile
	ECHO Case Compile
	CALL :zip %1 %2
	CALL :compile %1 %2 %3
	GOTO end_switch
:case_sign
	ECHO Case Sign
	CALL :zip %1 %2
	CALL :sign %1 %2 %3
	GOTO end_switch
:case_install
	ECHO Case Install
	GOTO :install
	GOTO end_switch
:case_uninstall
	ECHO Case Uninstall
	GOTO :uninstall
	GOTO end_switch
:end_switch
GOTO:EOF

:zip
:: zip files
ECHO Zipping files
del %1\%2.zip
:: Use your own zipping command
START /WAIT cmd /C "C:\Program Files\path\to\zipper.exe" %~1\%~2.zip %~1\*
GOTO:EOF

:compile
:: Compile
ECHO Compiling .bar
%sdkpath%\bbwp %~1\%~2.zip -o %~3
GOTO:EOF

:sign
:: Compile and sign
ECHO Compiling and signing .bar
%sdkpath%\bbwp %~1\%~2.zip -gcsk %csk% -gp12 %p12% -o %~3
GOTO:EOF

:install
::  Install
ECHO Installing .bar
%sdkpath%\blackberry-tablet-sdk\bin\blackberry-deploy.bat -installApp -device %ip% -password %devpass% -package %3\%2.bar
GOTO:EOF

:uninstall
::  Uninstall
ECHO Uninstalling .bar
%sdkpath%\blackberry-tablet-sdk\bin\blackberry-deploy.bat -uninstallApp -device %ip% -password %devpass% -package %3\%2.bar
GOTO:EOF

 

Any questions, let me know :smileyhappy:

--
Olivier - interfaSys ltd
Developing for BlackBerry 10 devices using the Sencha Touch framework.
New Contributor
gabmontes
Posts: 7
Registered: ‎11-10-2010
My Device: BlackBerry 10 Dev Alpha

Re: Sample Ant Build Script for Playbook WebWorks

Thanks for sharing!!!