-
-
Notifications
You must be signed in to change notification settings - Fork 607
/
register.py
33 lines (23 loc) · 1013 Bytes
/
register.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.engine.addresses import Addresses
from pants.engine.console import Console
from pants.engine.goal import Goal, GoalSubsystem
from pants.engine.rules import QueryRule, collect_rules, goal_rule
class ListAndDieForTestingSubsystem(GoalSubsystem):
"""A fast and deadly variant of `./pants list`."""
name = "list-and-die-for-testing"
help = "A fast and deadly variant of `./pants list`."
class ListAndDieForTesting(Goal):
subsystem_cls = ListAndDieForTestingSubsystem
@goal_rule
def fast_list_and_die_for_testing(console: Console, addresses: Addresses) -> ListAndDieForTesting:
for address in addresses:
console.print_stdout(address.spec)
return ListAndDieForTesting(exit_code=42)
def rules():
return [
*collect_rules(),
# NB: Would be unused otherwise.
QueryRule(ListAndDieForTestingSubsystem, []),
]