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