Sync of https://github.com/pantsbuild/pants/commit/21551b078b3b0fdc8cfda6510e818461bb2a99d6