mirror of
https://github.com/openai/codex.git
synced 2026-05-04 03:16:31 +00:00
## Why This branch brings the Bazel module pins for `rules_rs` and `llvm` up to the latest BCR releases and aligns the root direct dependencies with the versions the module graph already resolves to. That gives us a few concrete wins: - picks up newer upstream fixes in the `rules_rs` / `rules_rust` stack, including work around repo-rule nondeterminism and default Cargo binary target generation - picks up test sharding support from the newer `rules_rust` stack ([hermeticbuild/rules_rust#13](https://github.com/hermeticbuild/rules_rust/pull/13)) - picks up newer built-in knowledge for common system crates like `gio-sys`, `glib-sys`, `gobject-sys`, `libgit2-sys`, and `libssh2-sys`, which gives us a future path to reduce custom build-script handling - reduces local patch maintenance by dropping fixes that are now upstream and rebasing the remaining Windows patch stack onto a newer upstream base - removes the direct-dependency warnings from `bazel-lock-check` by making the root pins match the resolved graph ## What Changed - bump `rules_rs` from `0.0.43` to `0.0.58` - bump `llvm` from `0.6.8` to `0.7.1` - bump `bazel_skylib` from `1.8.2` to `1.9.0` so the root direct dep matches the resolved graph - regenerate `MODULE.bazel.lock` for the updated module graph - refresh the remaining Windows-specific patch stack against the newer upstream sources: - `patches/rules_rs_windows_gnullvm_exec.patch` - `patches/rules_rs_windows_exec_linker.patch` - `patches/rules_rust_windows_exec_std.patch` - `patches/rules_rust_windows_msvc_direct_link_args.patch` - remove patches that are no longer needed because the underlying fixes are upstream now: - `patches/rules_rs_delete_git_worktree_pointer.patch` - `patches/rules_rust_repository_set_exec_constraints.patch` ## Validation - `just bazel-lock-update` - `just bazel-lock-check` --------- Co-authored-by: Codex <noreply@openai.com>
67 lines
3.1 KiB
Diff
67 lines
3.1 KiB
Diff
# What: use a working Windows direct linker for `rules_rs` exec toolchains and
|
|
# preserve the Windows stdlib link flags the stable wrapper was dropping.
|
|
# Scope: Windows-only linker metadata for the generated `rules_rs` toolchains.
|
|
|
|
diff --git a/rs/experimental/toolchains/declare_rustc_toolchains.bzl b/rs/experimental/toolchains/declare_rustc_toolchains.bzl
|
|
--- a/rs/experimental/toolchains/declare_rustc_toolchains.bzl
|
|
+++ b/rs/experimental/toolchains/declare_rustc_toolchains.bzl
|
|
@@ -58,6 +58,8 @@ def declare_rustc_toolchains(
|
|
rust_toolchain(
|
|
name = rust_toolchain_name,
|
|
rust_doc = "{}rustdoc".format(rustc_repo_label),
|
|
+ linker = "{}rust-lld".format(rustc_repo_label) if exec_triple.system == "windows" else None,
|
|
+ linker_type = "direct" if exec_triple.system == "windows" else None,
|
|
rust_std = select(rust_std_select),
|
|
rustc = "{}rustc".format(rustc_repo_label),
|
|
cargo = "{}cargo".format(cargo_repo_label),
|
|
@@ -104,7 +106,20 @@ def declare_rustc_toolchains(
|
|
"@platforms//os:nixos": ["-ldl", "-lpthread"],
|
|
"@platforms//os:openbsd": ["-lpthread"],
|
|
"@platforms//os:ios": ["-lSystem", "-lobjc", "-Wl,-framework,Security", "-Wl,-framework,Foundation", "-lresolv"],
|
|
- # TODO: windows
|
|
+ "@rules_rs//rs/experimental/platforms/constraints:windows_gnullvm": [
|
|
+ "advapi32.lib",
|
|
+ "ws2_32.lib",
|
|
+ "userenv.lib",
|
|
+ "Bcrypt.lib",
|
|
+ ],
|
|
+ "@rules_rs//rs/experimental/platforms/constraints:windows_msvc": [
|
|
+ "advapi32.lib",
|
|
+ "ws2_32.lib",
|
|
+ "userenv.lib",
|
|
+ "Bcrypt.lib",
|
|
+ "ucrt.lib",
|
|
+ ],
|
|
+ # TODO: other platforms
|
|
"//conditions:default": [],
|
|
}),
|
|
default_edition = edition,
|
|
diff --git a/rs/private/rustc_repository.bzl b/rs/private/rustc_repository.bzl
|
|
--- a/rs/private/rustc_repository.bzl
|
|
+++ b/rs/private/rustc_repository.bzl
|
|
@@ -7,10 +7,24 @@ load(
|
|
)
|
|
load(":rust_repository_utils.bzl", "RUST_REPOSITORY_COMMON_ATTR", "download_and_extract")
|
|
+
|
|
+_WINDOWS_EXEC_LINKER_BUILD = """
|
|
+filegroup(
|
|
+ name = "rust-lld",
|
|
+ srcs = ["bin/lld-link.exe"],
|
|
+ visibility = ["//visibility:public"],
|
|
+)
|
|
+"""
|
|
|
|
def _rustc_repository_impl(rctx):
|
|
exec_triple = triple(rctx.attr.triple)
|
|
download_and_extract(rctx, "rustc", "rustc", exec_triple)
|
|
build_content = [BUILD_for_compiler(exec_triple)]
|
|
+ if exec_triple.system == "windows":
|
|
+ lld_link = rctx.which("lld-link.exe")
|
|
+ if lld_link == None:
|
|
+ fail("lld-link.exe not found on PATH")
|
|
+ rctx.symlink(lld_link, "bin/lld-link.exe")
|
|
+ build_content.append(_WINDOWS_EXEC_LINKER_BUILD)
|
|
if includes_rust_analyzer_proc_macro_srv(rctx.attr.version, rctx.attr.iso_date):
|
|
build_content.append(BUILD_for_rust_analyzer_proc_macro_srv(exec_triple))
|
|
rctx.file("BUILD.bazel", "\n".join(build_content))
|