Skip to content

[codex] Align Bazel opt mode with Cargo release - #27482

Closed
anp-oai wants to merge 1 commit into
codex/release-rbe-07-cross-release-cifrom
codex/release-rbe-08-cargo-opt-profile
Closed

[codex] Align Bazel opt mode with Cargo release#27482
anp-oai wants to merge 1 commit into
codex/release-rbe-07-cross-release-cifrom
codex/release-rbe-08-cargo-opt-profile

Conversation

@anp-oai

@anp-oai anp-oai commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Why

Bazel release binaries should use the same optimization and debug behavior as Cargo's release profile. Keeping those semantics attached to Bazel's standard opt mode avoids a second release-only flag list that can drift.

What changed

Patch the pinned rules_rust dependency so target-side opt builds use Cargo-compatible optimization, ThinLTO, debug info, stripping, split debug info, and codegen-unit defaults. Exec-side build scripts and proc macros retain Cargo's cheaper build-override defaults, while explicit upstream LTO and codegen-unit settings still take precedence.

Update the shared release-binaries config to select only opt.

Validation

  • Ran just build-for-release under RBE and produced all six release outputs.
  • Used Bazel action queries to verify target flags, exec-side flags, and explicit override precedence.
  • Ran just bazel-lock-check.

Stack: 8 of 8. Depends on #27456.

Comment thread .bazelrc
build:release-binaries --compilation_mode=fastbuild
build:release-binaries --@rules_rust//rust/settings:extra_rustc_flag=-Cdebug-assertions=no
build:release-binaries --@rules_rust//rust/settings:extra_exec_rustc_flag=-Cdebug-assertions=no
# Our pinned rules_rust patch maps `opt` mode to Cargo's release profile, so

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible for us to achieve the same outcome for the production binaries without patching rules_rust? it's ok if we don't get the same subtlety in the exec configuration as we'd like

@anp-oai
anp-oai force-pushed the codex/release-rbe-07-cross-release-ci branch from 0e763ef to 11a1377 Compare June 11, 2026 01:06
@anp-oai
anp-oai force-pushed the codex/release-rbe-08-cargo-opt-profile branch from 6f8fa2a to f4c44f3 Compare June 11, 2026 01:06
@anp-oai
anp-oai force-pushed the codex/release-rbe-07-cross-release-ci branch from 11a1377 to 3d1a9fb Compare June 11, 2026 01:21
@anp-oai
anp-oai force-pushed the codex/release-rbe-08-cargo-opt-profile branch from f4c44f3 to 2926239 Compare June 11, 2026 01:21
@anp-oai
anp-oai force-pushed the codex/release-rbe-07-cross-release-ci branch from 3d1a9fb to fd68340 Compare June 11, 2026 18:24
@anp-oai
anp-oai force-pushed the codex/release-rbe-08-cargo-opt-profile branch from 2926239 to 380f8c0 Compare June 11, 2026 18:24
@anp-oai anp-oai closed this Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant