Sync of https://github.com/pantsbuild/pants/commit/5b5b5253337adc4b093d245048fd5866b3941dbd