In my previous post, I discussed the first of several challenges I encountered when testing . In this, the second of three articles in the series, I will describe how I automatically deployed the tool for my own use.
Build and Deploy Local Eclipse Plugin
When developing software tools, it is good practice to by using the tool oneself. It is one of the easiest ways to uncover bugs and improve usability. I ate ReAssert's dog food by using it to repair tests in other research projects and (as I'll describe in the next post) ReAssert itself.
ReAssert is implemented as an plugin. The easiest way to deploy such a plugin is to include it in Eclipse's plugins directory1. When Eclipse starts, it automatically loads all plugins in the directory. If there is more than one version of a particular plugin, Eclipse loads the most recent.
To keep from having to install ReAssert's plugin manually, I made it such that the normal build process automatically updates version numbers and copies the plugin to the appropriate place. A single handles the entire process.
The main challenge lies in accessing Eclipse's build metadata in the script. Each Eclipse plugin holds the metadata in a file called MANIFEST.MF. It contains things like the plugin's name, it's version number, and the other plugins it depends on. For example, here is part of ReAssert's:
Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: edu.illinois.reassert.plugin Bundle-SymbolicName: edu.illinois.reassert.plugin;singleton:=true Bundle-Version: 0.3.0.201002231921 Bundle-Activator: edu.illinois.reassert.plugin.ReAssertPlugin Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, ... Bundle-Vendor: University of Illinois at Urbana-Champaign
ReAssert's build script first updates this file with the build number (based on the current date and time). Then, it reads the version and build number by converting MANIFEST.MF into a . Finally, it bundles the plugin using the values.
Here are the relevant pieces of the script that implements this process:
- Set the date and time with
, then replace the build number in the manifest with the date and time. - Convert
MANIFEST.MFintomanifest.propertiesthat Ant can read.2 - Set plugin name using the properties and bundle the plugin's JAR file.
- Copy the JAR to Eclipse's
pluginsdirectory. Theeclipse.homevariable is set when the script is run within Eclipse.Restart Eclipse to enable plugin
It is a pretty straightforward process but useful to keep my installed version of ReAssert up to date.
I have also seen a similar process scaled up to an entire enterprise. The company had an automated nightly build process that would post the plugin to an Eclipse Update Site on the local intranet. Every morning developers would update to the latest plugin. Any bugs they found while using the tool went straight into the bug tracking system.