mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
codex: align Bazel snapshot source remap
This commit is contained in:
13
defs.bzl
13
defs.bzl
@@ -84,6 +84,11 @@ def codex_rust_crate(
|
||||
"INSTA_SNAPSHOT_PATH": "src",
|
||||
}
|
||||
|
||||
cargo_like_package = native.package_name()
|
||||
if cargo_like_package.startswith("codex-rs/"):
|
||||
cargo_like_package = cargo_like_package[len("codex-rs/"):]
|
||||
snapshot_path_remap = "--remap-path-prefix=%s=%s" % (native.package_name(), cargo_like_package)
|
||||
|
||||
rustc_env = {
|
||||
"BAZEL_PACKAGE": native.package_name(),
|
||||
} | rustc_env
|
||||
@@ -128,8 +133,8 @@ def codex_rust_crate(
|
||||
env = test_env,
|
||||
deps = all_crate_deps(normal = True, normal_dev = True) + maybe_deps + deps_extra,
|
||||
# Keep `file!()` paths Cargo-like (`core/src/...`) instead of
|
||||
# Bazel workspace-prefixed (`codex-rs/core/src/...`) for snapshot parity.
|
||||
rustc_flags = rustc_flags_extra + ["--remap-path-prefix=codex-rs="],
|
||||
# Bazel package-prefixed (`codex-rs/core/src/...`) for snapshot parity.
|
||||
rustc_flags = rustc_flags_extra + [snapshot_path_remap],
|
||||
rustc_env = rustc_env,
|
||||
data = test_data_extra,
|
||||
tags = test_tags,
|
||||
@@ -176,8 +181,8 @@ def codex_rust_crate(
|
||||
compile_data = native.glob(["tests/**"], allow_empty = True) + integration_compile_data_extra,
|
||||
deps = all_crate_deps(normal = True, normal_dev = True) + maybe_deps + deps_extra,
|
||||
# Keep `file!()` paths Cargo-like (`core/tests/...`) instead of
|
||||
# Bazel workspace-prefixed (`codex-rs/core/tests/...`) for snapshot parity.
|
||||
rustc_flags = rustc_flags_extra + ["--remap-path-prefix=codex-rs="],
|
||||
# Bazel package-prefixed (`codex-rs/core/tests/...`) for snapshot parity.
|
||||
rustc_flags = rustc_flags_extra + [snapshot_path_remap],
|
||||
rustc_env = rustc_env,
|
||||
# Important: do not merge `test_env` here. Its unit-test-only
|
||||
# `INSTA_WORKSPACE_ROOT="codex-rs"` can point integration tests at the
|
||||
|
||||
Reference in New Issue
Block a user