Use NailgunTask's Java distribution consistently.
Review Request #3793 — Created April 30, 2016 and submitted
|jsirois, nhoward_tw, stuhood|
A few NailgunTasks need the JDK's tools.jar, and were fetching
its path by going to DistributionLocator, instead of using
the distribution it will later execute with.
In practice, today, these likely end up being the same distribution.
But in the future, if a particular task restricts its choice of
distribution then we could end up running in one JDK with the
tools.jar of another JDK on our classpath. This change prevents
that from happening.
CI passes: https://travis-ci.org/pantsbuild/pants/builds/126825440
Handle Distribution.Error where needed.
I don't think this was accurate before... if there isn't a JDK available at all, then there will be no javac.
In theory zinc might be using a better search path to locate the JDK and still succeed by forking javac, but it might be best to just allow the error to propagate here.
Definitely. Subclasses are also forking without a workunit, which makes its errors hard to find later.
Revision 3 (+22 -27)