forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 1
/
register.py
28 lines (18 loc) · 831 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
# 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 collect_rules, goal_rule
class ListAndDieForTestingSubsystem(GoalSubsystem):
"""A fast and deadly variant of `./pants list`."""
name = "list-and-die-for-testing"
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()