示例#1
0
def rule_runner() -> RuleRunner:
    return RuleRunner(
        rules=[
            *tailor.rules(),
            QueryRule(PutativeTargets, [PutativeShellTargetsRequest, AllOwnedSources]),
        ],
        target_types=[],
    )
示例#2
0
def rules():
    return [
        *dependency_inference.rules(),
        *shell_command.rules(),
        *shunit2_test_runner.rules(),
        *tailor.rules(),
        *target_types_rules(),
    ]
示例#3
0
def test_find_putative_targets() -> None:
    rule_runner = RuleRunner(
        rules=[
            *tailor.rules(),
            QueryRule(PutativeTargets,
                      [PutativeShellTargetsRequest, AllOwnedSources]),
        ],
        target_types=[],
    )
    rule_runner.write_files({
        f"src/sh/foo/{fp}": ""
        for fp in (
            "f.sh",
            "bar/baz1.sh",
            "bar/baz1_test.sh",
            "bar/baz2.sh",
            "bar/baz2_test.sh",
            "bar/baz3.sh",
        )
    })
    pts = rule_runner.request(
        PutativeTargets,
        [
            PutativeShellTargetsRequest(),
            AllOwnedSources(
                ["src/sh/foo/bar/baz1.sh", "src/sh/foo/bar/baz1_test.sh"]),
        ],
    )
    assert (PutativeTargets([
        PutativeTarget.for_target_type(ShellLibrary, "src/sh/foo", "foo",
                                       ["f.sh"]),
        PutativeTarget.for_target_type(ShellLibrary, "src/sh/foo/bar", "bar",
                                       ["baz2.sh", "baz3.sh"]),
        PutativeTarget.for_target_type(
            Shunit2Tests,
            "src/sh/foo/bar",
            "tests",
            ["baz2_test.sh"],
            kwargs={"name": "tests"},
        ),
    ]) == pts)
示例#4
0
def rules():
    return [
        *dependency_inference.rules(), *tailor.rules(),
        *shunit2_test_runner.rules()
    ]