Sync of https://github.com/pantsbuild/pants/commit/1874ad263a1c793146caa8e99d0c7e34e1c46978