get 'goal targets' using similar codepath to 'goal builddict'

Review Request #1112 - Created Oct. 3, 2014 and submitted

Information
Larry Hosken
pants
584
bf6e82b...
Reviewers
pants-reviews
jinfeng, jsirois

'goal targets' and the thing that builds build_dictionary.html used different code. At any given time, one or the other worked OK, but never both. Most recently, 'goal targets' doesn't show "inherited" docstrings :-( Also, if you wanted CLI help for a non-target thing like 'artifact', you got none :-(

This change...
moves builddict's reflection-y code out to backend/core/tasks/reflect.py . Tweaks 'goal targets' to get its info from reflect.py. Yay, one less code path. Has the nice side effect of pulling in help for 'artifact', not a target type but useful.

$ PANTS_DEV=1 ./pants goal targets
Running pants in dev mode from /Users/lhosken/workspace/lahosken_pants/src/python/pants/bin/pants_exe.py
android_binary: Produces an Android binary. :type build_type: s...
android_resources: Processes android resources to generate R.java...
annotation_processor: Produces a Java library containing one or more...
artifact: Represents a jvm artifact ala maven or ivy. Use...
...
wiki_artifact: Binds a single documentation page to a wiki ins...
zglobs: Returns a Fileset that matches zsh-style globs,...
$ PANTS_DEV=1 ./pants goal targets --targets-details=target
Running pants in dev mode from /Users/lhosken/workspace/lahosken_pants/src/python/pants/bin/pants_exe.py

target(name, payload, exclusives, name, address, build_graph, payload=None, exclusives=None)

A set of dependencies that may be depended upon,
as if depending upon the set of dependencies directly.

NB: This class is commonly referred to by the alias 'target' in BUILD files.

:type name: string
:param name: The name of this target, which combined with this
build file defines the target address.
:type dependencies: list of target specs
:param dependencies: Other targets that this target depends on.
:param exclusives: An optional map of exclusives tags.
Keeps incompatible changes apart <build_files.html#howto-check-exclusives>_.

Methods:

with_description(description)

Set a human-readable description of this target.

:param description: Descriptive string
$ PANTS_DEV=1 ./pants goal targets --targets-details=artifact
Running pants in dev mode from /Users/lhosken/workspace/lahosken_pants/src/python/pants/bin/pants_exe.py

artifact(org, name, repo, description=None)

Represents a jvm artifact ala maven or ivy.

Used in the provides parameter to jvm_library targets.

:param string org: Organization of this artifact, or groupId in maven parlance.
:param string name: Name of the artifact, or artifactId in maven parlance.
:param repo: The repo this artifact is published to.
:param string description: Description of this artifact.

Some decisions in this code I'm shaky on:

  • OK to lump together target types and things like 'jar'? (Was anyone relying on only-show-target-types?)

  • Is 'targets' still the right name for this goal? It's not just showing target types now. But... what's a better name? For a while I was calling this thing 'buildsyms', but I wasn't happy with it.

  • Should 'goal builddict' still be a thing? It's a thin layer above reflect.py. Maybe 'goal builddict' should go away and instead we could have 'goal targets --pretty-html' and 'goal goals --pretty-html'

started up https://travis-ci.org/pantsbuild/pants/builds/37021417

John Sirois
Larry Hosken
John Sirois
Larry Hosken
Review request changed

Status: Closed (submitted)

Loading...