WIP, NEED IDEAS: Move excludes logic into cmd_line_spec_parser so it can filter out broken build targets

Review Request #930 - Created Aug. 21, 2014 and discarded

Information
Eric Ayers
pants
zundel/exclude-targets-before-injection
Reviewers
pants-reviews
benjyw, jsirois, patricklaw
Move excludes logic into cmd_line_spec_parser so it can filter out broken build targets.

***  This is a work in progress, I don't want to commit things like this because it is extremely ugly. ***

I wanted to add integration test in testprojects/ in a previous patch that had an intentionally broken BUILD file, but I couldn't because pants threw an exception early trying to parse BUILD files.

  pants goal test testprojects:: will fail because one of the targets has a bogus dependency.

What I wanted to be able to do to get around this is:

  pants goal test testprojects:: --exclude-target-regexp=.*missing-build-file.* 

That did not work because the bad targets are first injected into the graph, then filtered out later.  The patch in this state fixes that issue by moving the --exclude-target-regexp code into cmd_line_spec_parser.py so that the build graph never sees them, but there are 2 problems:

1) The options aren't parsed yet when CmdLineSpecParser is instantiated.  I need the --exclude-target-regexp values.  I included an ugly hack to get around that.
2) The logger also isn't initialized yet because of problem #1)  I had a hack where I deferred printing the debug messages until run(), but surely there are other places where we want to log early.  I could replicate the ugly hack and examine the command line early in pants execution to turn on the logger... but I was hoping someone would have a better idea.



  

Issues

  • 1
  • 0
  • 0
  • 1
Description From Last Updated
Don't use mutable literals for default args, it's dangerous. Instead, default to `None` and then reset the variable immediately with ... Patrick Lawson Patrick Lawson
Eric Ayers
John Sirois
Stu Hood
Patrick Lawson
Eric Ayers
Review request changed

Status: Discarded

Loading...