Monday, December 9, 2013

Annual Timelord Update!

I'm from the planet Gallifrey in the constellation of Kasterborous. - The Doctor
My Timelord app has had two updates in the past two years. Last year when I switched jobs, got a new MacBook Pro Retina, and I realized that Timelord wasn't retina. UNACCEPTABLE. Staring at non-retina text was like applying sandpaper to my eyes. Then I learned there is a simple flag that makes Swing use Retina. Why is that not default? I don't know, but I fixed the build process to add it.
I haven't been actively time tracking for the past six months, so no big deal. A week ago I went to run Timelord and it wouldn't launch. Huh? Further investigation showed that the JavaApplicationStub bundling method only worked on Apple's version of Java, and since Oracle has taken over with updates, the program wouldn't launch anymore. One fix is to install the old Apple Java Runtime. Oracle to the rescue... sort of. There is a new version of the bundler from Oracle.
My build process uses Maven, because Maven is the cat's pajamas, but Oracle's bundler is an Ant Task. (grumble grumble).
After fumbling around for a while trying to get it working in Maven I gave up and just wrote an old-fashioned Ant build script. Works like a charm.
  <taskdef name="bundleapp"
         classname="com.oracle.appbundler.AppBundlerTask"
         classpath="src/lib/appbundler-1.0.jar" />

    <bundleapp outputdirectory="target"
        name="${app.name}"
        displayname="${app.name}"
        identifier="${app.mainclass}"
        icon="${app.icons}"
        mainclassname="${app.mainclass}" >

        <classpath dir="target/lib" />
        <option value="-Dapple.laf.useScreenMenuBar=true"/>
        <option value="-Dapple.awt.brushMetalLook=true"/>
    </bundleapp>

    <!-- Make Retina! -->
    <replaceregexp file="target/${app.name}.app/Contents/Info.plist"
               match="</dict>"
               replace="<key>NSHighResolutionCapable</key><true/></dict>"
               byline="true"
    />

See you next year when I need to update Timelord again for OSX Snow Mavericks