Lightweight coding agent that runs in your terminal
Rust
Use hermetic dsymutil for macOS Bazel builds (#55693)
Dmitriy Kovalenko6fb1c3903d42
diff --git a/.github/actions/build-bazel-release/action.yml b/.github/actions/build-bazel-release/action.ymlindex d305b6742d..78c3638ac4 100644--- a/.github/actions/build-bazel-release/action.yml+++ b/.github/actions/build-bazel-release/action.yml@@ -35,6 +35,7 @@ runs:run: |python3 .github/scripts/run_bazel_with_buildbuddy.py build \${{ runner.os == 'Windows' && '--config=ci-windows-msvc' || '' }} \+ ${{ runner.os == 'macOS' && '--config=ci-macos --remote_download_toplevel --build_metadata=VISIBILITY=PRIVATE' || '' }} \"--platforms=@rules_rs//rs/platforms:$TARGET" \"--//codex-rs:runtime_package_build_mode=$BUILD_MODE" \"//codex-rs:runtime_package_$BUNDLE"diff --git a/bazel/tools/BUILD.bazel b/bazel/tools/BUILD.bazelnew file mode 100644index 0000000000..3b9ea63a67--- /dev/null+++ b/bazel/tools/BUILD.bazel@@ -0,0 +1 @@+exports_files(["dsymutil"])diff --git a/bazel/tools/dsymutil b/bazel/tools/dsymutilnew file mode 100755index 0000000000..ff65a74daa--- /dev/null+++ b/bazel/tools/dsymutil@@ -0,0 +1,3 @@+#!/bin/sh+# rustc invokes dsymutil by name; the C toolchain supplies its hermetic path.+exec "${LLVM_DSYMUTIL:?missing hermetic dsymutil}" "$@"diff --git a/defs.bzl b/defs.bzlindex a297207b86..7fe51d40bc 100644--- a/defs.bzl+++ b/defs.bzl@@ -415,9 +415,15 @@ def codex_rust_crate(edition = crate_edition,# Scope each binary's compile data and linker flags to its generated# rust_binary so they do not affect sibling binaries.- compile_data = binary_compile_data_extra.get(binary, []),+ compile_data = binary_compile_data_extra.get(binary, []) + select({+ "@platforms//os:macos": ["//bazel/tools:dsymutil"],+ "//conditions:default": [],+ }),rustc_flags = rustc_flags_extra + binary_rustc_flags_extra.get(binary, []) + WINDOWS_RUSTC_LINK_FLAGS,- rustc_env = rustc_env,+ rustc_env = select({+ "@platforms//os:macos": rustc_env | {"PATH": "$${pwd}/bazel/tools:/bin:/usr/bin:/usr/local/bin"},+ "//conditions:default": rustc_env,+ }),# Keep stamp = 0: rules_rust otherwise makes stable-status.txt and# volatile-status.txt compiler inputs, even though we only consume# STABLE_GIT_COMMIT. BUILD_USER and BUILD_HOST vary across developers