Sync of https://github.com/pantsbuild/pants/commit/d90bdc0d4046a7d1b3d0c7b243ebc31de19bd9fb