Sync of https://github.com/pantsbuild/pants/commit/699f191fac38d5a782997206066be4be415bd3e9