Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion between Targets and their BUILD aliases. #2024

Closed
gmalmquist opened this issue Aug 19, 2015 · 7 comments
Closed

Conversion between Targets and their BUILD aliases. #2024

gmalmquist opened this issue Aug 19, 2015 · 7 comments
Assignees

Comments

@gmalmquist
Copy link
Contributor

There should be an easy way to do both:

  1. Given a Target type, lookup what BUILD aliases map to it.
  2. Given a BUILD file alias, lookup what Target type it corresponds to.

The motivation for this is allowing users to specify the names of BUILD file aliases (such as java_library) as options, which can be read and understood properly by tasks, subsystems, et cetera, rather than having to use internal names like JavaLibrary.

@jsirois
Copy link
Contributor

jsirois commented Aug 19, 2015

To be clear - the listed motivating case (an instance of 2. above) already is used / supported like so: https://github.com/pantsbuild/pants/blob/master/src/python/pants/backend/core/tasks/filter.py#L80-L84

@gmalmquist
Copy link
Contributor Author

Can that be done without a context, as in a subsystem or in a Target etc?

@jsirois
Copy link
Contributor

jsirois commented Aug 19, 2015

Nope - so that's a key requirement here then. The given-a-Target-instance case is straightforward for #1. The #2 case without a Context is more interesting, especially if implemented w/o a static global - which would be nice but also push/pull vs the goal here.

@jsirois jsirois self-assigned this Aug 30, 2015
@jsirois
Copy link
Contributor

jsirois commented Aug 30, 2015

I'll take #1 which is the only case I can currently find need for in the codebase.

@jsirois
Copy link
Contributor

jsirois commented Aug 31, 2015

OK - the solution for 1 above is in master @ ad9f848

Do you have a concrete use case for 2 above @gmalmquist? If not I'll close this.

@jsirois
Copy link
Contributor

jsirois commented Sep 2, 2015

I'll assign this to you @gmalmquist to close or else keep open / refine for the remaining criteria.

@jsirois jsirois assigned gmalmquist and unassigned jsirois Sep 2, 2015
@stuhood
Copy link
Member

stuhood commented Feb 12, 2016

(2) is possible via self.context.build_file_parser.registered_aliases(), although it is a bit awkward.

@stuhood stuhood closed this as completed Feb 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants