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