Make the name= target keyword optional in BUILD files.

Review Request #4275 - Created Oct. 1, 2016 and submitted

Information
Benjy Weinberger
pants
Reviewers
pants-reviews
kwlzn, stuhood, zundel
If omitted, it defaults to the name of the directory, which is
a nice, boilerplate-reducing convenience in support of a very
common idiom.

If omitted from two targets in the same BUILD family, you get the
error you expect, namely that two targets have the same name.

Note that Target instances still always requires a name; It's just
the machinery that creates them from BUILD files (both in the old
and new engine) that substitutes the default.  Targets created
in other ways (e.g., synthetically) must be provided with an
explicit name.

Adds tests for this, and also removes the names from a couple of
our example BUILD files, as added proof that it works.

Also fixes some of the build file parser exception tests:
previously they did throw exceptions, but not for the reason
the test author intended. Now we check the exception message
to be sure the failure is the one we meant.

CI passes: https://travis-ci.org/pantsbuild/pants/builds/164758047

Issues

  • 0
  • 3
  • 0
  • 3
Description From Last Updated
Eric Ayers
Mateo Rodriguez
Stu Hood
Nick Howard (Twitter)
Benjy Weinberger
Stu Hood
Benjy Weinberger
Nick Howard (Twitter)
Benjy Weinberger
Review request changed

Status: Closed (submitted)

Change Summary:

ac0fe8b7ae0e8d57370b0f14a177f3a7836fdd9a

Loading...