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