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