-
-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace the
goals
goal with a help
plugin which supports both v1 …
…and v2 (#7598) ### Problem In #6880, there will be two types of Goals: 1. v1 `pants.goal.goal.Goal`s, registered on a singleton 2. v2 `pants.engine.goal.Goal`s, registered as a `ScopeInfo` category via `@console_rules`. But `./pants goals` supports only the first form (via access to the singleton), and would need to dig deep into `self.context` in order to get access to the scope info (...like `./pants options` does: but that's a story for another day!). ### Solution Convert `./pants goals` into a plugin to the arg splitter, similar to `./pants help`. While the arg-splitter method is not incredibly scalable, it seems like it should be sufficiently scalable to support most of our "meta-goals". ### Result v1 and v2 Goals are supported, we have one fewer v1 Task, and #6880 is unblocked.
- Loading branch information
Stu Hood
authored
Apr 20, 2019
1 parent
9f3f01a
commit d31c194
Showing
12 changed files
with
76 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# coding=utf-8 | ||
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import absolute_import, division, print_function, unicode_literals | ||
|
||
from pants_test.pants_run_integration_test import PantsRunIntegrationTest | ||
|
||
|
||
class TestListGoalsIntegration(PantsRunIntegrationTest): | ||
def test_goals(self): | ||
command = ['goals'] | ||
pants_run = self.run_pants(command=command) | ||
self.assert_success(pants_run) | ||
self.assertIn('to get help for a particular goal', pants_run.stdout_data) | ||
# Spot check a few core goals. | ||
self.assertIn('list:', pants_run.stdout_data) | ||
self.assertIn('test:', pants_run.stdout_data) | ||
self.assertIn(' fmt:', pants_run.stdout_data) | ||
|
||
def test_ignored_args(self): | ||
# Test that arguments (some of which used to be relevant) are ignored. | ||
command = ['goals', '--all', '--graphviz', '--llama'] | ||
pants_run = self.run_pants(command=command) | ||
self.assert_success(pants_run) | ||
self.assertIn('to get help for a particular goal', pants_run.stdout_data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.