average-vr-56795
10/17/2018, 2:46 PMaverage-vr-56795
10/17/2018, 2:48 PMHydratedTarget -> TestResult
rule which knows everything and dispatches? Or typed `TestResult`s per target type? Or many rules which are invoked, which inspect the HydratedTarget
type and no-op if nothing to do? Or something else?witty-crayon-22786
10/17/2018, 4:01 PMwitty-crayon-22786
10/17/2018, 4:02 PMwitty-crayon-22786
10/17/2018, 4:02 PMwitty-crayon-22786
10/17/2018, 4:03 PMaverage-vr-56795
10/17/2018, 4:04 PMwitty-crayon-22786
10/17/2018, 4:04 PMwitty-crayon-22786
10/17/2018, 4:05 PMaverage-vr-56795
10/17/2018, 4:05 PMwitty-crayon-22786
10/17/2018, 4:06 PM@console_rule('test', [Select(Console), Select(HydratedTargets)])
def fast_test(console, hydrated_targets):
test_results = yield [Get(TestResult, HydratedTarget, ht) for ht in hydrated_targets]
... # use extracted static function to render the `TestResult` instances.
average-vr-56795
10/17/2018, 4:06 PMwitty-crayon-22786
10/17/2018, 4:06 PMaverage-vr-56795
10/17/2018, 4:06 PMwitty-crayon-22786
10/17/2018, 4:06 PMaverage-vr-56795
10/17/2018, 4:07 PMwitty-crayon-22786
10/17/2018, 4:07 PMaverage-vr-56795
10/17/2018, 5:09 PMwitty-crayon-22786
10/17/2018, 5:12 PM1.this is supported via
run_rule
, and is fairly painless: https://github.com/pantsbuild/pants/blob/master/tests/python/pants_test/engine/test_build_files.py#L32-L39witty-crayon-22786
10/17/2018, 5:13 PM@console_rule
... maybe it would?)witty-crayon-22786
10/17/2018, 5:13 PMwitty-crayon-22786
10/17/2018, 5:14 PMaverage-vr-56795
10/17/2018, 5:15 PMwitty-crayon-22786
10/17/2018, 5:16 PMrun_rule
with a @console_rule
would work with some minor tweakswitty-crayon-22786
10/17/2018, 5:16 PMwitty-crayon-22786
10/17/2018, 5:17 PM@console_rule
machinery already does that. so yea, should workwitty-crayon-22786
10/17/2018, 5:25 PMrun_rule
use actual types because they're relatively easy to construct, but should be possible to use python mocking as wellwitty-crayon-22786
10/17/2018, 5:26 PMwitty-crayon-22786
10/17/2018, 5:26 PMwitty-crayon-22786
10/17/2018, 5:37 PM