Sync of https://github.com/pantsbuild/pants/commit/28a018c7f47900aec4f576c81a52e0e4b41d9fec