xref: /aosp_15_r20/external/bazelbuild-rules_python/python/cc/BUILD.bazel (revision 60517a1edbc8ecf509223e9af94a7adec7d736b8)
1*60517a1eSAndroid Build Coastguard Worker# Package for C/C++ specific functionality of the Python rules.
2*60517a1eSAndroid Build Coastguard Worker
3*60517a1eSAndroid Build Coastguard Workerload("@bazel_skylib//:bzl_library.bzl", "bzl_library")
4*60517a1eSAndroid Build Coastguard Workerload("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED")
5*60517a1eSAndroid Build Coastguard Workerload("//python/private:current_py_cc_headers.bzl", "current_py_cc_headers")
6*60517a1eSAndroid Build Coastguard Workerload("//python/private:current_py_cc_libs.bzl", "current_py_cc_libs")
7*60517a1eSAndroid Build Coastguard Worker
8*60517a1eSAndroid Build Coastguard Workerpackage(
9*60517a1eSAndroid Build Coastguard Worker    default_visibility = ["//:__subpackages__"],
10*60517a1eSAndroid Build Coastguard Worker)
11*60517a1eSAndroid Build Coastguard Worker
12*60517a1eSAndroid Build Coastguard Worker# This target provides the C headers for whatever the current toolchain is
13*60517a1eSAndroid Build Coastguard Worker# for the consuming rule. It basically acts like a cc_library by forwarding
14*60517a1eSAndroid Build Coastguard Worker# on the providers for the underlying cc_library that the toolchain is using.
15*60517a1eSAndroid Build Coastguard Workercurrent_py_cc_headers(
16*60517a1eSAndroid Build Coastguard Worker    name = "current_py_cc_headers",
17*60517a1eSAndroid Build Coastguard Worker    # Building this directly will fail unless a py cc toolchain is registered,
18*60517a1eSAndroid Build Coastguard Worker    # and it's only under bzlmod that one is registered by default.
19*60517a1eSAndroid Build Coastguard Worker    tags = [] if BZLMOD_ENABLED else ["manual"],
20*60517a1eSAndroid Build Coastguard Worker    visibility = ["//visibility:public"],
21*60517a1eSAndroid Build Coastguard Worker)
22*60517a1eSAndroid Build Coastguard Worker
23*60517a1eSAndroid Build Coastguard Worker# This target provides the C libraries for whatever the current toolchain is for
24*60517a1eSAndroid Build Coastguard Worker# the consuming rule. It basically acts like a cc_library by forwarding on the
25*60517a1eSAndroid Build Coastguard Worker# providers for the underlying cc_library that the toolchain is using.
26*60517a1eSAndroid Build Coastguard Workercurrent_py_cc_libs(
27*60517a1eSAndroid Build Coastguard Worker    name = "current_py_cc_libs",
28*60517a1eSAndroid Build Coastguard Worker    # Building this directly will fail unless a py cc toolchain is registered,
29*60517a1eSAndroid Build Coastguard Worker    # and it's only under bzlmod that one is registered by default.
30*60517a1eSAndroid Build Coastguard Worker    tags = [] if BZLMOD_ENABLED else ["manual"],
31*60517a1eSAndroid Build Coastguard Worker    visibility = ["//visibility:public"],
32*60517a1eSAndroid Build Coastguard Worker)
33*60517a1eSAndroid Build Coastguard Worker
34*60517a1eSAndroid Build Coastguard Workertoolchain_type(
35*60517a1eSAndroid Build Coastguard Worker    name = "toolchain_type",
36*60517a1eSAndroid Build Coastguard Worker    visibility = ["//visibility:public"],
37*60517a1eSAndroid Build Coastguard Worker)
38*60517a1eSAndroid Build Coastguard Worker
39*60517a1eSAndroid Build Coastguard Workerbzl_library(
40*60517a1eSAndroid Build Coastguard Worker    name = "py_cc_toolchain_bzl",
41*60517a1eSAndroid Build Coastguard Worker    srcs = ["py_cc_toolchain.bzl"],
42*60517a1eSAndroid Build Coastguard Worker    visibility = ["//visibility:public"],
43*60517a1eSAndroid Build Coastguard Worker    deps = ["//python/private:py_cc_toolchain_macro_bzl"],
44*60517a1eSAndroid Build Coastguard Worker)
45*60517a1eSAndroid Build Coastguard Worker
46*60517a1eSAndroid Build Coastguard Workerbzl_library(
47*60517a1eSAndroid Build Coastguard Worker    name = "py_cc_toolchain_info_bzl",
48*60517a1eSAndroid Build Coastguard Worker    srcs = ["py_cc_toolchain_info.bzl"],
49*60517a1eSAndroid Build Coastguard Worker    visibility = ["//visibility:public"],
50*60517a1eSAndroid Build Coastguard Worker    deps = ["//python/private:py_cc_toolchain_info_bzl"],
51*60517a1eSAndroid Build Coastguard Worker)
52*60517a1eSAndroid Build Coastguard Worker
53*60517a1eSAndroid Build Coastguard Workerfilegroup(
54*60517a1eSAndroid Build Coastguard Worker    name = "distribution",
55*60517a1eSAndroid Build Coastguard Worker    srcs = glob(["**"]),
56*60517a1eSAndroid Build Coastguard Worker)
57