Make the name= target keyword optional in BUILD files.
Review Request #4275 — Created Oct. 1, 2016 and submitted — Latest diff uploaded
|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
Loading file attachments...