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