xref: /aosp_15_r20/prebuilts/clang-tools/BUILD.bazel (revision bed243d3d9cd544cfb038bfa7be843dedc6e6bf7)
1package(default_visibility = ["//visibility:public"])
2
3[filegroup(
4    name = platform,
5    srcs = glob(
6        [
7            "%s/bin/*" % platform,
8            "%s/lib/*" % platform,
9            "%s/lib64/*" % platform,
10            "%s/clang-headers/*" % platform,
11        ],
12        allow_empty = True,
13    ),
14) for platform in ("linux-x86", "darwin-x86")]
15
16sh_binary(
17    name = "versioner",
18    srcs = select({
19        "//build/bazel_common_rules/platforms/os:linux": [":linux-x86/bin/versioner"],
20        "//build/bazel_common_rules/platforms/os:darwin": [":darwin-x86/bin/versioner"],
21        "//conditions:default": ["@platform//:incompatible"],
22    }),
23    data = [":clang-tools.runfiles"],
24)
25
26# Runfiles (e.g. shared libraries) required by clang tools like versioner.
27# These files will be copied to sbox alongside the clang tool.
28# This is not stricly necessary in Bazel builds because Bazel uses a symlink based
29# sbox implementation (and the bins have a curated rpath embedded inside it)
30# But this might be relevant in Mixed builds with Soong which uses a cp based
31# sbox implementation.
32filegroup(
33    name = "clang-tools.runfiles",
34    srcs = select({
35        "//build/bazel_common_rules/platforms/os:linux": glob(
36            [":linux-x86/lib64/**/*"],
37            allow_empty = True,
38        ),
39        "//build/bazel_common_rules/platforms/os:darwin": glob(
40            [":darwin-x86/lib64/**/*"],
41            allow_empty = True,
42        ),
43        "//conditions:default": ["@platform//:incompatible"],
44    }),
45)
46