From 2668789560dbae60f203aaf82450966f17a8390d Mon Sep 17 00:00:00 2001 From: zbarsky-openai Date: Thu, 19 Feb 2026 16:38:37 -0500 Subject: [PATCH] [bazel] Fix proc_macro_dep libs (#12274) If a first-party proc_macro crate has tests/binaries that would get autogenerated by the macro, it was being handled incorrectly. Found by an external OS contributor! --- defs.bzl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/defs.bzl b/defs.bzl index b3fe9903e..6be15d80f 100644 --- a/defs.bzl +++ b/defs.bzl @@ -141,9 +141,10 @@ def codex_rust_crate( tags = test_tags, ) - maybe_lib = [name] - else: - maybe_lib = [] + if proc_macro: + proc_macro_deps += [name] + else: + deps += [name] sanitized_binaries = [] cargo_env = {} @@ -156,7 +157,7 @@ def codex_rust_crate( name = binary, crate_name = binary.replace("-", "_"), crate_root = main, - deps = maybe_lib + deps, + deps = deps, proc_macro_deps = proc_macro_deps, edition = crate_edition, rustc_flags = rustc_flags_extra, @@ -183,7 +184,7 @@ def codex_rust_crate( srcs = [test], data = native.glob(["tests/**"], allow_empty = True) + sanitized_binaries + test_data_extra, compile_data = native.glob(["tests/**"], allow_empty = True) + integration_compile_data_extra, - deps = maybe_lib + deps + dev_deps + integration_deps_extra, + deps = deps + dev_deps + integration_deps_extra, proc_macro_deps = proc_macro_deps + proc_macro_dev_deps, # Keep `file!()` paths Cargo-like (`core/tests/...`) instead of # Bazel workspace-prefixed (`codex-rs/core/tests/...`) for snapshot parity.