Sync of https://github.com/pantsbuild/pants/commit/5098580fe951f30baba81084140cbe212ced615d