Sync of https://github.com/pantsbuild/pants/commit/775805015f0e6c212267ce34e91fc3a5cf3a6b2d