Sync of https://github.com/pantsbuild/pants/commit/6bff6a00885a6c524a0f98270dc30160f2a666a8