mirror of
https://github.com/openai/codex.git
synced 2026-11-18 07:00:27 +00:00
Make Bazel binary stamping opt-in (#43282)
## Why Binaries that do not consume build identity should not have their cached compilations invalidated by Git revisions or build timestamps. ## What changed Add `stamped_binaries` to `codex_rust_crate`, defaulting to an empty list. Only listed binaries enable stamping and receive `STABLE_GIT_COMMIT`. Opt in `codex`, `codex-tui`, and `codex-voice-host`. GitOrigin-RevId: 9bcac29f98f20129c988f696ce5b98057be7a158
This commit is contained in:
1 parent
8283bc56b1
commit
8d7cc24a87
4 files changed
+10
-4
No files matched your search
@@ -9,6 +9,7 @@ codex_rust_crate(
|
|||||||
"//codex-rs/bwrap:bwrap",
|
"//codex-rs/bwrap:bwrap",
|
||||||
],
|
],
|
||||||
rustc_flags_extra = MACOS_WEBRTC_RUSTC_LINK_FLAGS,
|
rustc_flags_extra = MACOS_WEBRTC_RUSTC_LINK_FLAGS,
|
||||||
|
stamped_binaries = ["codex"],
|
||||||
test_data_extra = glob(["src/**/snapshots/**"]),
|
test_data_extra = glob(["src/**/snapshots/**"]),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ codex_rust_crate(
|
|||||||
],
|
],
|
||||||
integration_compile_data_extra = ["src/test_backend.rs"],
|
integration_compile_data_extra = ["src/test_backend.rs"],
|
||||||
rustc_flags_extra = MACOS_WEBRTC_RUSTC_LINK_FLAGS,
|
rustc_flags_extra = MACOS_WEBRTC_RUSTC_LINK_FLAGS,
|
||||||
|
stamped_binaries = ["codex-tui"],
|
||||||
test_data_extra = glob([
|
test_data_extra = glob([
|
||||||
"src/**/*.rs",
|
"src/**/*.rs",
|
||||||
"src/**/snapshots/**",
|
"src/**/snapshots/**",
|
||||||
|
|||||||
@@ -4,5 +4,6 @@ codex_rust_crate(
|
|||||||
name = "voice-host",
|
name = "voice-host",
|
||||||
crate_name = "codex_voice_host",
|
crate_name = "codex_voice_host",
|
||||||
crate_srcs = [],
|
crate_srcs = [],
|
||||||
|
stamped_binaries = ["codex-voice-host"],
|
||||||
unit_test_args = ["--test-threads=1"],
|
unit_test_args = ["--test-threads=1"],
|
||||||
)
|
)
|
||||||
@@ -195,6 +195,7 @@ def codex_rust_crate(
|
|||||||
lib_data_extra = [],
|
lib_data_extra = [],
|
||||||
rustc_flags_extra = [],
|
rustc_flags_extra = [],
|
||||||
binary_rustc_flags_extra = {},
|
binary_rustc_flags_extra = {},
|
||||||
|
stamped_binaries = [],
|
||||||
rustc_env = {},
|
rustc_env = {},
|
||||||
rustc_env_files = [],
|
rustc_env_files = [],
|
||||||
deps_extra = [],
|
deps_extra = [],
|
||||||
@@ -239,6 +240,9 @@ def codex_rust_crate(
|
|||||||
lib_data_extra: Extra runtime data for the library target.
|
lib_data_extra: Extra runtime data for the library target.
|
||||||
binary_rustc_flags_extra: Mapping from binary names to extra rustc
|
binary_rustc_flags_extra: Mapping from binary names to extra rustc
|
||||||
flags for those binary targets.
|
flags for those binary targets.
|
||||||
|
stamped_binaries: Binary names that read STABLE_GIT_COMMIT at compile
|
||||||
|
time. Other binaries omit workspace status inputs so Git revisions
|
||||||
|
and build timestamps do not invalidate their cached compilations.
|
||||||
rustc_env: Extra rustc_env entries to merge with defaults.
|
rustc_env: Extra rustc_env entries to merge with defaults.
|
||||||
rustc_env_files: Generated compiler environment files for the library target.
|
rustc_env_files: Generated compiler environment files for the library target.
|
||||||
deps_extra: Extra normal deps beyond @crates resolution.
|
deps_extra: Extra normal deps beyond @crates resolution.
|
||||||
@@ -403,11 +407,10 @@ def codex_rust_crate(
|
|||||||
# generated rust_binary instead of leaking it to sibling binaries.
|
# generated rust_binary instead of leaking it to sibling binaries.
|
||||||
compile_data = binary_compile_data_extra.get(binary, []),
|
compile_data = binary_compile_data_extra.get(binary, []),
|
||||||
rustc_flags = rustc_flags_extra + binary_rustc_flags_extra.get(binary, []) + WINDOWS_RUSTC_LINK_FLAGS,
|
rustc_flags = rustc_flags_extra + binary_rustc_flags_extra.get(binary, []) + WINDOWS_RUSTC_LINK_FLAGS,
|
||||||
# rules_rust substitutes workspace status values only for stamped
|
# Only consumers of build identity need workspace status inputs.
|
||||||
# actions, so pass the existing key through to final binaries.
|
rustc_env = {"STABLE_GIT_COMMIT": "{STABLE_GIT_COMMIT}"} if binary in stamped_binaries else {},
|
||||||
rustc_env = {"STABLE_GIT_COMMIT": "{STABLE_GIT_COMMIT}"},
|
|
||||||
srcs = native.glob(["src/**/*.rs"]),
|
srcs = native.glob(["src/**/*.rs"]),
|
||||||
stamp = 1,
|
stamp = 1 if binary in stamped_binaries else 0,
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user