anathema/anathema — pull request #307 by curttasker (2012-10-29 04:45:08+00:00)
Title: Java7 with JRE bundling on Win/Mac

I finally have a solid release ready for the new Java 7 with JRE bundling support for our Windows and Mac users.

### Here's how it works:

There's 3 new tasks, `prepareJRE`, `prepareWinJRE`, and `prepareMacJRE`. The Win and Mac tasks are dependencies of the `buildWin` and `buildMac` tasks, and are automatically called. When run, these tasks will download (if necessary) a JRE archive from our release server, and cache it in the gradle cache with the rest of the dependencies. It then explodes the archives into the `build/jre/` folder.

`buildWin` normally uses launch4j to create an exe launcher for anathema. Its now been configured to look for a JRE in the `*anathemaInstallLocation*/jre/` folder, and use this if present. Otherwise, it falls back on the systemwide JRE.

`buildMac` normally creates a mac application bundle manually, by positioning the proper files in the proper locations. It has been completely rewritten using an Oracle ant task designed for Java7. It creates a Mac application bundle and includes a copy of the JRE inside the bundle.

`releaseWin` creates our NSIS installer package; It now bundles the JRE into the installer package, and extracts it to the `*anathemaInstallLocation*/jre/` folder. It removes the `jre/` folder upon uninstallation of Anathema.

### Impact on our users
The JRE bundling is going to require that we force our users to re-download anathema from our website each time we choose to update the JRE. Hopefully this will be an infrequent occurrence. Currently Java 1.7.0_09 is the bundled JRE , which is very recent, and should tide us over for a while.

### What if our users prefer to use their own JRE?
If the end user desires, it is still possible to have Anathema use the systemwide installed JRE. They can, of course, run the anathema.jar file from the windows installation, or download and use the Zip release, which does not bundle a JRE.

For Windows, simply deleting the `*anathemaInstallLocation*/jre/` folder will cause the anathema.exe launcher to fall back on the systemwide JRE.

For Mac, it requires the following steps:
- Right click on Anathema, select Show Package Contents.
- Go into the `Contents/PlugIns` folder and delete the contents of this folder.
- Go back out to `Contents/Info.plist`. Right click the file, Open With, Other…
- Select the TextEdit application.
- Delete the following two lines from the file and save it:
- `JVMRuntime`
- `jre1.7.0_09`

### Feedback
Anyways, I'd love a little third-party testing and feedback of this before we move forward with it. So far I've tested:
- Building on Win7 and installing on Mac 10.8.2 with Java 1.6 and 1.7 as a systemwide JRE.
- Building on Mac 10.8.2 then installing on Win7 with Java 1.6 and 1.7 as a systemwide JRE.

You'll need to have JDK 1.7.0_09 installed, just do a `./gradlew release` on any platform. The first time you do this, it has to download around 100 megs of data from our release server, so it may take a few minutes. Also be warned that the buildWin task now takes a bit longer to execute, because it performs some serious compression on all the JRE files. The entire release process for successive runs should be around 2-3 minutes on a SSD.