Make java artifact caching less sloppy.

Also make creating the processors info file happen even
when we pulled from the artifact cache.
Fix invalidation bugs.

1) Delete the hash-file before building a target, so that if
   the build aborts and leaves the output dir in a bad state
   and then we revert the change, we force a rebuild.

2) Ensure hashes are computed consistently.