Sync of https://github.com/pantsbuild/pants/commit/47dd00954052f9259f9fa64201b31bf82cb780bb