Sync of https://github.com/pantsbuild/pants/commit/8667470a7dd68b013ee9c8147ba9c7c19cd62ffe