blob: f4e4aeb00f1f2ad22dbe07d065ed971191b2cb51 [file] [log] [blame]
Richard Levasseurb8f16452023-07-08 09:58:12 -07001# Package for C/C++ specific functionality of the Python rules.
2
3load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
Chris Lovea068d1b2023-07-10 13:41:33 -06004load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED")
Richard Levasseurb8f16452023-07-08 09:58:12 -07005load("//python/private:current_py_cc_headers.bzl", "current_py_cc_headers")
Richard Levasseur39610a72024-01-24 13:22:05 -08006load("//python/private:current_py_cc_libs.bzl", "current_py_cc_libs")
Richard Levasseurb8f16452023-07-08 09:58:12 -07007
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
Richard Levasseur39610a72024-01-24 13:22:05 -080023# 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
Richard Levasseurb8f16452023-07-08 09:58:12 -070034toolchain_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"],
Richard Levasseur5a856e52024-09-16 19:07:40 -070043 deps = ["//python/private:py_cc_toolchain_macro_bzl"],
Richard Levasseurb8f16452023-07-08 09:58:12 -070044)
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)