From 447e6ed13e4a8c1794c71a8db03a081a4723af39 Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Fri, 3 Oct 2025 08:49:24 +0200 Subject: [PATCH 1/2] rework rules_cc usage * bump to version 0.2.9 --- MODULE.bazel | 2 +- build_defs.bzl | 9 ++++++--- pybind11-BUILD.bazel | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 6225a9a..91e39ce 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -7,7 +7,7 @@ module( bazel_dep(name = "bazel_features", version = "1.36.0") bazel_dep(name = "bazel_skylib", version = "1.8.1") bazel_dep(name = "platforms", version = "1.0.0") -bazel_dep(name = "rules_cc", version = "0.1.4") +bazel_dep(name = "rules_cc", version = "0.2.9") bazel_dep(name = "rules_python", version = "1.5.1") internal_configure = use_extension("//:internal_configure.bzl", "internal_configure_extension") diff --git a/build_defs.bzl b/build_defs.bzl index bf740c6..6197400 100644 --- a/build_defs.bzl +++ b/build_defs.bzl @@ -6,6 +6,9 @@ """Build rules for pybind11.""" load("@bazel_skylib//rules:copy_file.bzl", "copy_file") +load("@rules_cc//cc:cc_binary.bzl", "cc_binary") +load("@rules_cc//cc:cc_library.bzl", "cc_library") +load("@rules_cc//cc:cc_test.bzl", "cc_test") def register_extension_info(**kwargs): pass @@ -58,7 +61,7 @@ def pybind_extension( # Mark common dependencies as required for build_cleaner. tags = tags + ["req_dep=%s" % dep for dep in PYBIND_DEPS] - native.cc_binary( + cc_binary( name = name + ".so", copts = copts + PYBIND_COPTS + select({ Label("@pybind11//:msvc_compiler"): [], @@ -106,7 +109,7 @@ def pybind_library( # Mark common dependencies as required for build_cleaner. tags = tags + ["req_dep=%s" % dep for dep in PYBIND_DEPS] - native.cc_library( + cc_library( name = name, copts = copts + PYBIND_COPTS, features = features + PYBIND_FEATURES, @@ -127,7 +130,7 @@ def pybind_library_test( # Mark common dependencies as required for build_cleaner. tags = tags + ["req_dep=%s" % dep for dep in PYBIND_DEPS] - native.cc_test( + cc_test( name = name, copts = copts + PYBIND_COPTS, features = features + PYBIND_FEATURES, diff --git a/pybind11-BUILD.bazel b/pybind11-BUILD.bazel index a9b7c02..3a4c776 100644 --- a/pybind11-BUILD.bazel +++ b/pybind11-BUILD.bazel @@ -1,5 +1,5 @@ # pybind11 - Seamless operability between C++11 and Python. -load("@rules_cc//cc:defs.bzl", "cc_library") +load("@rules_cc//cc:cc_library.bzl", "cc_library") licenses(["notice"]) From 6595dc17d9253b3cc8af4d23209166a7346a25ad Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Fri, 3 Oct 2025 08:49:52 +0200 Subject: [PATCH 2/2] bump dependencies to last release --- MODULE.bazel | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 91e39ce..75c2073 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -5,10 +5,10 @@ module( ) bazel_dep(name = "bazel_features", version = "1.36.0") -bazel_dep(name = "bazel_skylib", version = "1.8.1") +bazel_dep(name = "bazel_skylib", version = "1.8.2") bazel_dep(name = "platforms", version = "1.0.0") bazel_dep(name = "rules_cc", version = "0.2.9") -bazel_dep(name = "rules_python", version = "1.5.1") +bazel_dep(name = "rules_python", version = "1.6.3") internal_configure = use_extension("//:internal_configure.bzl", "internal_configure_extension") use_repo(internal_configure, "pybind11")