WebWorks Ant Build Script

Open Source

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?

About Tim W.

Tim is an Open Source Technical Lead at BlackBerry, focusing on WebWorks, HTML5, and Open Source.

Join the conversation

Show comments Hide comments
+ -
  • http://www.sutocom.net SutoCom
  • http://nerdberry.net/2012/11/09/devs-webworks-includes-ant-build-scripts/ Devs: WebWorks Includes Ant Build Scripts! | NerdBerry.net

    […] viaInsideBB Share/Bookmark […]

  • http://genteblackberry.wordpress.com/2012/11/22/desarrolladores-rim-lanza-guias-de-blackberry-10-para-portar-aplicaciones-phonegap-juegos-android-apps-y-qt/ *DESARROLLADORES* RIM lanza Guias de BlackBerry 10 para portar aplicaciones PhoneGap, Juegos Android / Apps, y Qt | News Channel

    […] WebWorks Ant Build Guión – Great stuff! […]

  • http://devblog.blackberry.com/2013/01/create-debug-version-of-webworks-app/ Creating a Debug Version of your WebWorks Application for Built For BlackBerry | BlackBerry Developer Blog

    […] the simplest way to create the debug version of the application is to use the Apache Ant build script. But if Ant just ain’t your thing, no worries – you can create your debug application using […]

  • http://blackberryphoneshop.info/2013/01/02/creating-a-debug-version-of-your-webworks-application-for-built-for-blackberry/ Creating a Debug Version of your WebWorks Application for Built For BlackBerry | BlackBerry and Phone Shop

    […] the simplest way to create the debug version of the application is to use the Apache Ant build script. But if Ant just ain’t your thing, no worries – you can create your debug application using […]

  • http://devblog.blackberry.com/2013/02/sublime-blackberry-10-webworks-development/ Sublime BlackBerry 10 WebWorks Development | BlackBerry Developer Blog

    […] Build System integration. I put together a video showing how to setup our BlackBerry 10 WebWorks Ant Build Script with Sublime, so you can see how easy it […]

  • http://www.sdknews.com/blackberry/sublime-blackberry-10-webworks-development Sublime BlackBerry 10 WebWorks Development | SDK News

    […] Build System integration. I put together a video showing how to setup our BlackBerry 10 WebWorks Ant Build Script with Sublime, so you can see how easy it […]

  • http://blackberrydeveloper.com.br/categorias/tutoriais/build-e-deploy-de-projetos-webworks-com-o-sublime-text-2/ Build e Deploy de projetos WebWorks com o Sublime Text 2 | BlackBerry Dev Groups Brasil

    […] WebWorks Ant Build Script […]

blog comments powered by Disqus