Files
codex/patches/rules_rust.patch
zbarsky-openai 8497163363 [bazel] Improve runfiles handling (#10098)
we can't use runfiles directory on Windows due to path lengths, so swap
to manifest strategy. Parsing the manifest is a bit complex and the
format is changing in Bazel upstream, so pull in the official Rust
library (via a small hack to make it importable...) and cleanup all the
associated logic to work cleanly in both bazel and cargo without extra
confusion
2026-01-29 00:15:44 +00:00

35 lines
2.1 KiB
Diff

diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl
index a28ad50b7..af627fe50 100644
--- a/rust/private/rustc.bzl
+++ b/rust/private/rustc.bzl
@@ -2361,19 +2361,19 @@ def _get_make_link_flag_funcs(target_os, target_abi, use_direct_link_driver):
- callable: The function for producing link args.
- callable: The function for formatting link library names.
"""
+
+ get_lib_name = get_lib_name_default
+
if target_os == "windows":
- make_link_flags_windows_msvc = _make_link_flags_windows_msvc_direct if use_direct_link_driver else _make_link_flags_windows_msvc_indirect
- make_link_flags_windows_gnu = _make_link_flags_windows_gnu_direct if use_direct_link_driver else _make_link_flags_windows_gnu_indirect
- make_link_flags = make_link_flags_windows_msvc if target_abi == "msvc" else make_link_flags_windows_gnu
- get_lib_name = get_lib_name_for_windows
+ if target_abi == "msvc":
+ make_link_flags = _make_link_flags_windows_msvc_direct if use_direct_link_driver else _make_link_flags_windows_msvc_indirect
+ get_lib_name = get_lib_name_for_windows
+ else:
+ make_link_flags = _make_link_flags_windows_gnu_direct if use_direct_link_driver else _make_link_flags_windows_gnu_indirect
elif target_os.startswith(("mac", "darwin", "ios")):
- make_link_flags_darwin = _make_link_flags_darwin_direct if use_direct_link_driver else _make_link_flags_darwin_indirect
- make_link_flags = make_link_flags_darwin
- get_lib_name = get_lib_name_default
+ make_link_flags = _make_link_flags_darwin_direct if use_direct_link_driver else _make_link_flags_darwin_indirect
else:
- make_link_flags_default = _make_link_flags_default_direct if use_direct_link_driver else _make_link_flags_default_indirect
- make_link_flags = make_link_flags_default
- get_lib_name = get_lib_name_default
+ make_link_flags = _make_link_flags_default_direct if use_direct_link_driver else _make_link_flags_default_indirect
return (make_link_flags, get_lib_name)