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