Avoid clobbering `type_alias` kwarg in the `Registrar` if already explicitly set.

Review Request #4106 - Created July 21, 2016 and submitted

Kris Wilson
gmalmquist, jsirois, stuhood

This change repairs a case in our internal pants plugins where the v2 engine misrepresents the type alias of a TargetMacro (in our case, testbox_tests targets have a type_alias of java_tests which breaks in the face of a malaligned set of validation rules).

  • Avoid clobbering type_alias kwarg in the Registrar if already explicitly set.
  • Move an initialization routine in LegacyBuildGraph.__init__ into a method (a ~useful vestige of a discarded change).
  • Repair integration test breakage caused by this change in the v2 integration tests seen here: https://travis-ci.org/pantsbuild/pants/builds/146258107 due to an explicit definition of type_alias='alias_target', which AFAICT is incorrect (given the target in BUILD is alias, this should be alias IIUC) and ultimately not used or referenced anywhere else in the code base that I can see:

    [illuminati pants (kwlzn/engine/targetmacro_identity_crisis)]$ ag alias_target
    [illuminati pants (kwlzn/engine/targetmacro_identity_crisis)]$


+ verified via integration testing that this repairs the breakage case in our internal monorepo.

John Sirois
Yujie Chen
Kris Wilson
Review request changed

Status: Closed (submitted)

Change Summary:

thanks John & Yujie! submitted @ 1955d9e85b6e5df254e5279a5d080cc84b51879a