Make LegacyAddressMapper v2 engine backed

Review Request #4239 - Created Sept. 15, 2016 and submitted

Information
Yujie Chen
pants
3871, 3875
Reviewers
pants-reviews
jsirois, kwlzn, nhoward_tw, stuhood

When testing v2 engine in OSS pants master, I found that LegacyAddressMapper is missing a scan_build_files method which is used in v1 BuildFileAddressMapper, thus causing some test failures. In addition, LegacyAddressMapper internally relies on LegacyBuildGraph to do things. This dependency is unnecessary.

This change adds the missing method to LegacyAddressMapper, and implements all methods of LAM using v2 engine directly.

A summary of this review:
1. Implement "scan_build_files" on LegacyAddressMapper. As part of the effort, add a new selection_request method in LocalScheduler class.
2. Modify all other methods of LegacyAddressMapper to use v2 engine directly, and remove the dependency on LegacyBuildGraph.
3. Remove "resolve_spec" method in AddressMapper base class, replace with a new method called "check_valid_spec", which will check if input spec is valid or not. This suffices the only use case of resolve_spec in master without returning an unused TargetAddressable.
4. Add a new "resolve_address" method in BuildGraph, which will replace the usage of "address_mapper.resolve" in master. This is done to unify the behavior between v1 and v2 engine, since in v2 engine, only LegacyBuildGraph has instantiated target objects (ProductGraph only has TargetAdaptor).
5. Modify test cases for LegacyAddressMapper
6. Add some missing dependencies in several BUILD files.
7. Fix a bug in go_buildgen()

https://travis-ci.org/pantsbuild/pants/builds/163454699

Issues

  • 0
  • 3
  • 0
  • 3
Description From Last Updated
Yujie Chen
Yujie Chen
Yujie Chen
Stu Hood
Kris Wilson
Nick Howard (Twitter)
Yujie Chen
Yujie Chen
Stu Hood
Nick Howard (Twitter)
Yujie Chen
Review request changed

Status: Closed (submitted)

Change Summary:

Merged as https://github.com/pantsbuild/pants/commit/482014d98b2d02e1a7b81d93d172b9d3db2ff6e4
Thanks Stu, Kris and Nick!

Loading...