| Richard Levasseur | b8f1645 | 2023-07-08 09:58:12 -0700 | [diff] [blame] | 1 | # Package for C/C++ specific functionality of the Python rules. |
| 2 | |
| 3 | load("@bazel_skylib//:bzl_library.bzl", "bzl_library") |
| Chris Love | a068d1b | 2023-07-10 13:41:33 -0600 | [diff] [blame] | 4 | load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED") |
| Richard Levasseur | b8f1645 | 2023-07-08 09:58:12 -0700 | [diff] [blame] | 5 | load("//python/private:current_py_cc_headers.bzl", "current_py_cc_headers") |
| Richard Levasseur | 39610a7 | 2024-01-24 13:22:05 -0800 | [diff] [blame] | 6 | load("//python/private:current_py_cc_libs.bzl", "current_py_cc_libs") |
| Richard Levasseur | b8f1645 | 2023-07-08 09:58:12 -0700 | [diff] [blame] | 7 | |
| 8 | package( |
| 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. |
| 15 | current_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 Levasseur | 39610a7 | 2024-01-24 13:22:05 -0800 | [diff] [blame] | 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. |
| 26 | current_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 Levasseur | b8f1645 | 2023-07-08 09:58:12 -0700 | [diff] [blame] | 34 | toolchain_type( |
| 35 | name = "toolchain_type", |
| 36 | visibility = ["//visibility:public"], |
| 37 | ) |
| 38 | |
| 39 | bzl_library( |
| 40 | name = "py_cc_toolchain_bzl", |
| 41 | srcs = ["py_cc_toolchain.bzl"], |
| 42 | visibility = ["//visibility:public"], |
| Richard Levasseur | 5a856e5 | 2024-09-16 19:07:40 -0700 | [diff] [blame] | 43 | deps = ["//python/private:py_cc_toolchain_macro_bzl"], |
| Richard Levasseur | b8f1645 | 2023-07-08 09:58:12 -0700 | [diff] [blame] | 44 | ) |
| 45 | |
| 46 | bzl_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 | |
| 53 | filegroup( |
| 54 | name = "distribution", |
| 55 | srcs = glob(["**"]), |
| 56 | ) |