title: Cordova/PhoneGap Plugin Development Workflow for Android
body: <p>I am developing a set of Cordova plugins.  The initial implementation will be Android only, so for now I am interested in being able to use ADT in Eclipse for plugin development.  I've read over the documentation and have been able to get the first plugin completed, but the workflow is a bit of a pain.  I couldn't find any docs or tools in Cordova that specifically support plugin development workflow.  I wonder if I am making it harder than it needs to be? Here is what I am doing.</p>
  
  <p>The plugin is set up according to the cordova plugin spec.  I started by setting up the directory structure and editing the files in Sublime, so I have something like:</p>
  
  <ul>
  <li>$PLUGIN_ROOT
  <ul>
  <li>src
  <ul>
  <li>android
  <ul>
  <li>Plugin.java</li>
  </ul></li>
  </ul></li>
  <li>www
  <ul>
  <li>plugin.js</li>
  </ul></li>
  <li>plugin.xml</li>
  </ul></li>
  </ul>
  
  <p>I set all of that up with boilerplate and an initial implementation.
  Then to start testing, I created a cordova project, added the android platform, added my plugin and built:</p>
  
  <pre><code>cordova create testProject
  cd testProject
  cordova platform add android
  cordova plugin add $PLUGIN_ROOT
  cordova build
  cordova run
  </code></pre>
  
  <p>After doing all that, I import testProject/platforms/android into ADT and start editing Plugin.java and plugin.js, as well as assets/www to add a test harness.</p>
  
  <p>Now, after getting everything working the way I want it to, I have to manually copy all of the changed files (plus any files I've added) back into the appropriate place under $PLUGIN_ROOT.  I also want to preserve my test harness, probably in $PLUGIN_ROOT/test.  This isn't too bad the first time, but after several iterations it's all getting a little unwieldy.  It also seems very error-prone to do it manually, but I can't really use a merge tool to do it for me, because the directory structure is different.  I could write a script, but then I'll be adding more maintenance overhead.  That being said, I'm currently planning on writing scripts to do this for each of the plugins that I am going to write.</p>
  
  <p>Is there a better way?  I'd really like to hear how the cordova plugin developers manage this.  Thanks.</p>