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