aboutsummaryrefslogtreecommitdiff
path: root/toolchains/unittest/BUILD
blob: dd23962aebc1fe727e7a81ad987fde6e8886a073 (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
load("//lib:unittest.bzl", "TOOLCHAIN_TYPE", "unittest_toolchain")

licenses(["notice"])

toolchain_type(
    name = "toolchain_type",
    visibility = ["//visibility:public"],
)

unittest_toolchain(
    name = "cmd",
    escape_chars_with = {"%": "%"},
    failure_templ = """@echo off
echo %s
exit /b 1
""",
    file_ext = ".bat",
    join_on = "\necho ",
    success_templ = "@exit /b 0",
    visibility = ["//visibility:public"],
)

toolchain(
    name = "cmd_toolchain",
    exec_compatible_with = [
        "@platforms//os:windows",
    ],
    toolchain = ":cmd",
    toolchain_type = TOOLCHAIN_TYPE,
)

unittest_toolchain(
    name = "bash",
    escape_other_chars_with = "\\",
    failure_templ = """#!/bin/sh
echo %s
exit 1
""",
    file_ext = ".sh",
    join_on = "\necho ",
    success_templ = "#!/bin/sh\nexit 0",
    visibility = ["//visibility:public"],
)

toolchain(
    name = "bash_toolchain",
    toolchain = ":bash",
    toolchain_type = TOOLCHAIN_TYPE,
)

filegroup(
    name = "test_deps",
    testonly = True,
    srcs = [
        "BUILD",
    ],
    visibility = ["//:__subpackages__"],
)

# The files needed for distribution
filegroup(
    name = "distribution",
    srcs = ["BUILD"],
    visibility = [
        "//:__pkg__",
    ],
)