5:46 am - Friday September 19, 2014

WebWorks Ant Build Script

There are many ways to build BlackBerry WebWorks applications, like the Ripple Emulator, the BlackBerry Graphical Aid, or the command line. Each one has some good use cases, and yet I think there’s room for one more: an Ant build script that can include some pre-processing and will work well with automated builds.

Ant has been around a long time so it really needs no introduction. Inspiration for this build script came initially from Addy Osmani’s blog on creating a build script for web applications, and later from reviewing the HTML5 Boilerplate’s Ant-Build-Script project. This script is much more specific to BlackBerry WebWorks development and should serve as a great starting point for any developer wanting to introduce a build script to their WebWorks development cycle.

Ant scripts are great for a lot of reasons. Designed for build systems, with simple XML syntax, it’s been around long enough to get a lot of support from IDE’s and to have extensions and tutorials written for it. While there are newer build script tools available, Ant is a good, reliable tool. The IDE integration will be popular with many developers as well, since Eclipse and it’s variants work well with Ant. My current favorite is Sublime Text 2 which has superb build script integration: when set to Ant, pressing ctrl-b will run the default build in the current file’s directory. Besides working with your IDE, build scripts can do all sorts of repeatable operations for you, which can automate routine steps, saving time and maintaining consistency between builds. An obvious requirement for teams, but still a real time saver when working solo.

When I set out to create this script, I wanted something with a wide range of flexibility but also something simple that I could just drop into a project and have it build. I also wanted to be able to update some settings in one place when something changed but support project specific build targets. Lastly, I thought it would be pretty cool to do some Lint checking and code compression at the same time. The result is up here on Github and takes a two part approach. There is a main set of targets and associated tools that goes in one spot and a build.xml file that can be dropped into a WebWorks project. The main file you will setup once and only change when new SDKs are installed. The project file you will put a copy in each project and define a few simple properties to customize the build. Full instructions are included in the Github Readme.

Give it a try today and see what you think. Once you’ve done so, I’d really like to see some forks and pull requests that add additional targets. What are the tools that you would like to see included?

image

Excerpt from:  

WebWorks Ant Build Script

Filed in: BlackBerry

No comments yet.

Leave a Reply

Spam protection by WP Captcha-Free