I’ve recently had several conversations with PhoneGap users around processes for automating the compilation of PhoneGap apps. This could be either in automated tasks using Grunt, Ant, Maven, or any other task manager, or could be in continuous integration environments like Jenkins CI.
If you’re interested in this, here are a few options… First of all, PhoneGap Build has a REST API. You can use this to programmatically create new projects, update projects, trigger new builds (even just for specific platforms), etc… This can integrate with your build scripts and tie into any workflow.
If you’re using GitHub, it is possible to tie into hooks triggering PhoneGap Build to recompile every time you commit your code. Here’s an example of it in action, or you can just use this service which is already setup: http://autobuild.monkeh.me/ (from the same author) - Just be careful with your user/pass in plain text. Update: You can also use the Autobuild service using a clientID variable instead of sending through username and password details via HTTP.
If you aren’t using PhoneGap Build, you’re not out of luck. All PhoneGap CLI commands are based on scripts, which themselves can be scripted. You could use ANT’s exec command, the Maven exec plugin, Grunt exec or Grunt shell plugins, Jenkins execute shell, or any other task runner to manually invoke the PhoneGap CLI. You just need to make sure all your environment and path variables are correct to access SDKs and required programs. However, there’s one caveat… iOS builds require Xcode/Apple developer tools, which have to be run on a Mac.
If you’re using Jenkins, this might be a good one to check out: Jenkins CI + PhoneGap & Cordova