Fix spurious Products requirements.

Review Request #1662 - Created Jan. 24, 2015 and submitted

Information
John Sirois
pants
jsirois/engine/yaks/fix_products
989
483742d...
Reviewers
pants-reviews
benjyw, ity, zundel

The trio of require, isrequired and get - the original members of
products - are tricky and they have invalid semantics in the
product-driven RoundEngine.

This change fixes things such that a `.get(<typename>)` does not have
the effect of causing a subsequent `.isrequired(<typename>)` check to be
truthy.

Going forward, the idea of requiring a product for a subset of targets -
the role of the `.require` predicate today - will be subsumed by the
tuple-based engine.

src/python/pants/goal/products.py | 20 ++++++++----
tests/python/pants_test/BUILD | 1 +
tests/python/pants_test/goal/BUILD | 10 ++++++
tests/python/pants_test/goal/__init__.py | 0
tests/python/pants_test/goal/test_products.py | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 113 insertions(+), 7 deletions(-)

I ran into this in the ProtobufGen imports handling in a pretty subtle
way when working on an engine change.

In (not so) short, ApacheThriftGen runs 1st, and in the post-processing
phase in the CodeGen superclass where synthetic targets are linked, a
call to products.get('python') ends up making 'python' products
required. This in turn influences the subsequent ProtobufGen (another
CodeGen sublclass) run, incorrectly telling it that 'python' protobuf
gen products are required.

CI went green here:
https://travis-ci.org/pantsbuild/pants/builds/48218578

John Sirois
John Sirois
Benjy Weinberger
John Sirois
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Ity Kaul
Ship It!
Loading...