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

Java Development

Reply
Developer
JCarty
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

OTA Script for Deployment - Works with Eclipse, JDE

[ Edited ]

This is by no means a replacement for bb-ant-tools or any other build projects. This code is something I wrote and have been using for a few months and it has saved some time.  I figured I would share it with the community since we need as many resources as we can get to speed up development (RIM take note - we want to make apps for your platform faster). If you see room for improvement, let me know. If you have your own deployment methods that you'd care to share, post them here.

 

Requires 7-zip on your PATH. Download 7-zip here:

 

http://www.7-zip.org/download.html (Fine to drop the command-line exe into your System32 folder)

 

This script works with Windows 7 and Windows Vista.

 

Save the following code to a .vbs file in the folder where your cod files are built and *** MAKE SURE TO EDIT THE UPPERCASED VALUES IN THE CODE WITH YOUR PATHS OR IT WILL NOT WORK ***:

 

 

Set fso = CreateObject("Scripting.FileSystemObject") 
Set wsh = CreateObject("Wscript.Shell")
	
If WScript.Arguments.length = 0 Then
	Set osa = CreateObject("Shell.Application")
	
osa.ShellExecute "wscript.exe", Chr(34) & _
WScript.ScriptFullName & Chr(34) & " uac " & Chr(34) & fso.GetFolder(".") & Chr(34), "", "runas", 1
Set osa = Nothing
Else
dim project, fso, wsh, otaPath,currPath, sevenZEx, jdeBinPath

jdeBinPath = "YOUR_JDE_OR_ECLIPSE_PLUGIN_BIN_PATH"
signatureTool = jdeBinPath & "SignatureTool.jar -a -c """ & currPathE & codName & """"
updateJadTool = jdeBinPath & "UpdateJad"

project = "FINAL_COD_NAME"
jadName = project & ".jad"
codName = project & ".cod"

otaPath = "PATH_TO_SAVE_OTA_FILES"
otaPathE = otaPath & "\"

currPath = WScript.Arguments(1)
currPathE = currPath & "\"

origJad = currPathE & jadName
deployJadName = project & ".jad"
deployJad = otaPathE & deployJadName

libraries = "PLACE_LIBRARY_CODS_HERE_SEPARATED_BY_SPACE_OR_LEAVE_BLANK"

sevenZEx = "7za e"

' SIGN PROJECT
wsh.Run signatureTool, 1, True

' DELETE FILES FROM OTA DIRECTORY
If WildCardFileExists(otaPathE, project) Then
fso.DeleteFile otaPathE & project & "*", True
End If

' COPY JAD FILE
If fso.FileExists(origJad) Then
fso.CopyFile origJad, otaPathE, True
End If

' COPY JAR AND COD FILES
fso.CopyFile currPathE & "*.jar", otaPathE, True
fso.CopyFile currPathE & "*.cod", otaPathE, True

' RENAME COD TO ZIP FILE
fso.MoveFile otaPathE & codName, otaPathE & project & ".zip"

' EXTRACT ZIP
wsh.Run sevenZEx & " " & otaPathE & project & ".zip -aoa -o" & otaPathE, 0, True

' DELETE ZIP FILE
fso.DeleteFile otaPathE & project & ".zip"

' RENAME JAD TO DESIRED NAME
fso.MoveFile otaPathE & jadName, deployJad

' UPDATE THE JAD TO INCLUDE LIBRARIES
wsh.Run "cmd /C CD " & otaPathE & " & " & updateJadTool & " " & deployJadName & " " & libraries, 0, True

' DELETE LogFile
If fso.FileExists(currPathE & "LogFile.txt") Then fso.DeleteFile currPathE & "LogFile.txt" End If End If Function WildCardFileExists(path, filename) Dim fs : Set fs = CreateObject("Scripting.FileSystemObject") Dim folder : Set folder = fs.GetFolder(path) Dim item WildCardFileExists = false For Each item In folder.Files If InStr(item.Name, filename) <> 0 Then WildCardFileExists = true Exit For End If Next End Function Set fso = Nothing Set wsh = Nothing Set xmlDoc = Nothing

 

Here's what to expect from this script:

 

  • Prompts to sign COD files
  • Extracts COD siblings if COD file is larger than 64KB
  • Copies COD files to folder specified
  • Updates your JAD file to include library COD files

NOTE: You have to copy the library COD files to your OTA directory in order for the script to update your  jad file. I may improve this later.

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Please use plain text.
Developer
weaselgrater
Posts: 87
Registered: ‎08-25-2009
My Device: Not Specified

Re: OTA Script for Deployment - Works with Eclipse, JDE

[ Edited ]

For each JRE that we want to deploy a build for, do we need to specify the appropriate Eclipse plugin folder?

 

net.rim.ejde.componentpack5.0.0_5.0.0.25\components\bin for 5.0

net.rim.ejde.componentpack4.7.0_4.7.0.53\components\bin for 4.7

etc

Please use plain text.
Developer
JCarty
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: OTA Script for Deployment - Works with Eclipse, JDE

That is correct. However, if you're using the Eclipse 1.1 plug-in, most of this script has been implemented in the plug-in.

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Please use plain text.
Developer
weaselgrater
Posts: 87
Registered: ‎08-25-2009
My Device: Not Specified

Re: OTA Script for Deployment - Works with Eclipse, JDE

You mean the COD files in Standard/OSNUMBER/ are good to go?

Please use plain text.
Developer
JCarty
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: OTA Script for Deployment - Works with Eclipse, JDE

[ Edited ]

Standard is good for BES and Desktop deployment.

 

Web is good for OTA deployment.

 

They both work fine.

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Please use plain text.