2
0
Fork 0
mirror of https://github.com/bazelbuild/bazel-skylib synced 2024-12-03 17:52:40 +00:00
bazel-skylib/toolchains/unittest/BUILD
Alexandre Rostovtsev 43c6185e7e
Make only root test_deps externally visible (#508)
All other test_deps targets implicitly require the root BUILD file
for the `license` target for their default_applicable_licenses;
therefore, users should only depend on the root test_deps target.
2024-07-15 17:57:10 +00:00

70 lines
1.3 KiB
Python

load("//lib:unittest.bzl", "TOOLCHAIN_TYPE", "unittest_toolchain")
package(default_applicable_licenses = ["//:license"])
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__"], # Needs skylib's root BUILD file for default_applicable_licenses
)
# The files needed for distribution
filegroup(
name = "distribution",
srcs = ["BUILD"],
visibility = [
"//:__pkg__",
],
)