Hello!
If you follow me on twitter, you certainly know that I was at a Ruby conference these past few days. As yesterday was Whyday, I decided to remove the ant build script and replace it with rake. This means two things:
- Install JRuby, or you can't build JavaOp anymore.
- Builds are a lot more awesome.
The ant script ran clean,build,jar on my MacBook Pro in about 8 seconds. Rake runs clean,build,jar in just under 13. You're probably thinking, "whytf did you do that, then?". Most of the startup time for rake with JRuby is loading a JVM (and using standard rake isn't an option for building Java projects). There's a neat project called Nailgun that keeps a server JVM running in the background. By typing 'jruby --ng-server &', you'll start up a Nailgun server, and then run 'jruby --ng -S rake clean build jar'. This still takes 13 seconds. However, JVM has been optimizing the compiler. Running it again only takes 7 seconds, so the ant script is outperformed after only two runs. The next takes 5 seconds. Do you see a trend? It's unlikely that I'll sit down, fix a bug, test, commit and push in one build cycle, and if I do, it only cost me an extra 5 seconds in build time.
Equally important, and much more important to users, is that rake is awesome for testing. I was using JUnit before, mostly to fix some CheckRevision bugs I made by testing local hashing directly against BNLS. JUnit is a real pain. I need to download the JAR, put it in the correct place, figure out dependencies and classpaths, etc etc, and maybe it'll run. Check this out:
[00:52:48] [william@enterprise ~/Documents/Git/GitHub/javaop2]$ jruby --ng -S rake test
Loaded suite /Users/william/bin/jruby-1.6.3/bin/rake
Started
Testing D2DV.. local: 573e1c0c, remote: 573e1c0c
Testing D2XP.. local: 7264e3da, remote: 7264e3da
Testing STAR.. local: -5bab8e79, remote: -5bab8e79
Testing W2BN.. local: -3122f25d, remote: -3122f25d
Testing WAR3.. local: 32a227d6, remote: 32a227d6
Testing W3XP.. local: 32a227d6, remote: 32a227d6
.....
Finished in 1.061 seconds.
5 tests, 15 assertions, 0 failures, 0 errors
This is really neat because now every time I run rake tests, it makes sure I didn't break CheckRevision. Unit testing is a Ruby philosophy, and being adopted in a bunch of other communities. Now, if I break CheckRevision (through any means leading up to the absolute result that gets sent to BNET), I'll be immediately notified. I'm sure this makes rabbit very, very happy.
Happy JavaOping.