xref: /aosp_15_r20/external/bazel-skylib/toolchains/unittest/BUILD (revision bcb5dc7965af6ee42bf2f21341a2ec00233a8c8a)
1load("//lib:unittest.bzl", "TOOLCHAIN_TYPE", "unittest_toolchain")
2
3package(default_applicable_licenses = ["//:license"])
4
5licenses(["notice"])
6
7toolchain_type(
8    name = "toolchain_type",
9    visibility = ["//visibility:public"],
10)
11
12unittest_toolchain(
13    name = "cmd",
14    escape_chars_with = {"%": "%"},
15    failure_templ = """@echo off
16echo %s
17exit /b 1
18""",
19    file_ext = ".bat",
20    join_on = "\necho ",
21    success_templ = "@exit /b 0",
22    visibility = ["//visibility:public"],
23)
24
25toolchain(
26    name = "cmd_toolchain",
27    exec_compatible_with = [
28        "@platforms//os:windows",
29    ],
30    toolchain = ":cmd",
31    toolchain_type = TOOLCHAIN_TYPE,
32)
33
34unittest_toolchain(
35    name = "bash",
36    escape_other_chars_with = "\\",
37    failure_templ = """#!/bin/sh
38echo %s
39exit 1
40""",
41    file_ext = ".sh",
42    join_on = "\necho ",
43    success_templ = "#!/bin/sh\nexit 0",
44    visibility = ["//visibility:public"],
45)
46
47toolchain(
48    name = "bash_toolchain",
49    toolchain = ":bash",
50    toolchain_type = TOOLCHAIN_TYPE,
51)
52
53filegroup(
54    name = "test_deps",
55    testonly = True,
56    srcs = [
57        "BUILD",
58    ],
59    visibility = ["//:__subpackages__"],
60)
61
62# The files needed for distribution
63filegroup(
64    name = "distribution",
65    srcs = ["BUILD"],
66    visibility = [
67        "//:__pkg__",
68    ],
69)
70