Filter inactive goals from `Goal.all`.

Review Request #4298 — Created Oct. 12, 2016 and submitted

jsirois
pants
jsirois/issues/3945
3945, 3949
150ee3d...
pants-reviews
benjyw, mateor
Introduce the concept of a goal's `active` status.  Most goals are in
fact active (have at least 1 task installed), but some may not if there
are no plugins providing tasks to the goal installed.

 src/python/pants/goal/goal.py                         | 21 +++++++++++++++++++--
 tests/python/pants_test/core_tasks/BUILD              |  2 ++
 tests/python/pants_test/core_tasks/test_list_goals.py | 32 +++++++++++++++++++++++---------
 3 files changed, 44 insertions(+), 11 deletions(-)

Local ad-hoc:

$ ./pants goals | grep buildgen
               buildgen: Automatically generate BUILD files.
$ git diff -U1
diff --git a/pants.ini b/pants.ini
index e859654..ac08cec 100644
--- a/pants.ini
+++ b/pants.ini
@@ -46,3 +46,3 @@ backend_packages: +[
     "pants.contrib.findbugs",
-    "pants.contrib.go",
+#    "pants.contrib.go",
     "pants.contrib.scalajs",
@@ -272,6 +272,6 @@ timeout_default: 60

-[buildgen.go]
-materialize: True
-remote: True
-fail_floating: True
+#[buildgen.go]
+#materialize: True
+#remote: True
+#fail_floating: True

$ ./pants goals | grep buildgen
^$

CI went green here:
https://travis-ci.org/pantsbuild/pants/builds/167457316

MA
  1. Ship It!
  2. 
      
JS
NH
  1. Ship It!

    Couple questions

    • If goals are registered but have no tasks, how does a plugin writer know they can install their tasks on one of them? The obvious answer is to point them at src/python/pants/core_tasks/register.py. It might also make sense to update dev_tasks to note that goals without tasks can exist and that they are hidden from the UI.

    • Currently, inactive goals have no effect on options because option scopes are constructed based on the tasks each goal owns. If we move to having core inactive goals, should inactive goals be present in options handling so that they are not shadowed by other task or subsystem options?

    1. Good idea on 1st, added a section on goal discovery to that doc.  I'll pass on engaging with the second since that's completely new and I'm not even sure exactly what it means without reviewing how the options system works today (I'm out of touch on shadowing, recursiveness, etc).
  2. src/python/pants/goal/goal.py (Diff revision 1)
     
     

    nit: Maybe update to say Returns all active registered goals...

  3. 
      
JS
NH
  1. Ship It!
  2. 
      
ST
  1. Ship It!
  2. 
      
JS
JS
Review request changed

Status: Closed (submitted)

Change Summary:

Now on master:

git log -1 origin/master
commit 1485434d282f3430c9d30642f3b10b7a0f07c0ab
Author: John Sirois <john.sirois@gmail.com>
Date:   Thu Oct 13 14:50:25 2016 -0600

    Filter inactive goals from `Goal.all`.
    
    Introduce the concept of a goal's `active` status.  Most goals are in
    fact active (have at least 1 task installed), but some may not if there
    are no plugins providing tasks to the goal installed.
    
    Testing Done:
    Local ad-hoc:
    ```
    $ ./pants goals | grep buildgen
                   buildgen: Automatically generate BUILD files.
    $ git diff -U1
    diff --git a/pants.ini b/pants.ini
    index e859654..ac08cec 100644
    --- a/pants.ini
    +++ b/pants.ini
    @@ -46,3 +46,3 @@ backend_packages: +[
         "pants.contrib.findbugs",
    -    "pants.contrib.go",
    +#    "pants.contrib.go",
         "pants.contrib.scalajs",
    @@ -272,6 +272,6 @@ timeout_default: 60
    
    -[buildgen.go]
    -materialize: True
    -remote: True
    -fail_floating: True
    +#[buildgen.go]
    +#materialize: True
    +#remote: True
    +#fail_floating: True
    
    $ ./pants goals | grep buildgen
    ^$
    ```
    
    CI went green here:
      https://travis-ci.org/pantsbuild/pants/builds/167457316
    
    Bugs closed: 3945, 3949
    
    Reviewed at https://rbcommons.com/s/twitter/r/4298/
Loading...