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

Allow goals to specify that at least one spec is needed #221

Closed
ericzundel opened this issue Jun 13, 2014 · 2 comments
Closed

Allow goals to specify that at least one spec is needed #221

ericzundel opened this issue Jun 13, 2014 · 2 comments

Comments

@ericzundel
Copy link
Member

This invocation of pants specifies a goal but no targets. It does a lot of work and reports SUCCESS, but is almost certainly not what the user wants, no code is actually compiled.

./pants goal compile

10:02:18 00:00 [main]
               (To run a reporting server: ./pants goal server)
10:02:18 00:00   [bootstrap]
10:02:18 00:00   [setup]
10:02:18 00:00     [parse]
10:02:18 00:00   [jvm-locate]
10:02:18 00:00   [jvm-locate]
10:02:18 00:00   [jvm-locate]
10:02:18 00:00   [jvm-locate]
10:02:18 00:00   [jvm-locate]
10:02:19 00:01   [jvm-locate]
10:02:19 00:01   [jvm-locate]
10:02:19 00:01   [bootstrap]
10:02:19 00:01     [bootstrap-jvm-tools]
10:02:19 00:01   [gen]
10:02:19 00:01     [thrift]
10:02:19 00:01     [scrooge]
10:02:19 00:01     [protoc]
10:02:19 00:01     [antlr]
10:02:19 00:01     [jaxb]
10:02:19 00:01   [check-exclusives]
10:02:19 00:01     [check-exclusives]
10:02:19 00:01   [resolve]
10:02:19 00:01     [ivy]
10:02:19 00:01       [bootstrap-nailgun]
10:02:19 00:01   [compile]
10:02:19 00:01     [jvm]
10:02:19 00:01       [jvm-compilers]
               SUCCESS

It would help in the argument parsing to know if a goal required one or more targets to be useful because there can be ambiguity between specs and goals if you have a BUILD file one directory deep. Say

pants goal compile compile

If there were a BUILD file named compile/BUILD then this wouldn't be ambiguous (although you can think of other invocations that would be ambiguous)

Garrett and I are going back and forth on how far to take this.

I am on the side that says if you specify a goal like 'compile' but when it gets to the compile phase there are no targets to run, that might be an error (somehow you would want to make sure that there weren't targets that were originally in the graph that you didn't need to run because the results were cached.)

I have been bitten so many times by specifying a goal that doesn't actually depend on any targets that would be directly executed by the goal (like saying running 'goal test' on a /src/... target that doesn't contain any test target types instead of a /tests/target

./pants goal test src/java/com/pants/examples/pingpong/main

10:11:07 00:00 [main]
               (To run a reporting server: ./pants goal server)
10:11:08 00:01   [bootstrap]
10:11:08 00:01   [setup]
10:11:08 00:01     [parse]
...
10:11:12 00:05   [test]
10:11:12 00:05     [pytest]
10:11:12 00:05     [junit]
10:11:12 00:05     [specs]
               Waiting for background workers to finish.
               SUCCESS

I would consider this to be a pants invocation failure, no tests were ever in the graph to run.

@ericzundel
Copy link
Member Author

See also #3651

@Eric-Arellano
Copy link
Contributor

Closing as V2 goals now have a mechanism for doing this by requesting Addresses or Targets in the rule signature, then erroring if it's == 0. Currently, we only error in certain cases if too many targets are given, rather than too little, but it's trivial to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants