Migrate to bzlmod with Valdi registry and release tags#12
Merged
Conversation
Migrate from WORKSPACE-only to bzlmod: - Add MODULE.bazel declaring valdi dependency and sub-module overrides - Bundle third-party patches (rules_swift, rules_kotlin, rules_android_ndk, websocketpp) needed because Valdi's single_version_override entries only apply when Valdi is the root module - Remove --noenable_bzlmod from .bazelrc - Fix per_file_copt patterns for bzlmod compatibility - WORKSPACE kept for backwards compatibility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The beta-0.0.3 release predates the macos_deps feature in valdi_module. Point to the same commit SHA the WORKSPACE uses. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Each archive_override sub-module downloads the full Valdi tarball separately, causing timeouts in CI. Clone Valdi once and use --override_module flags to point all sub-modules to the local checkout. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The llvm extension in toolchains_llvm enforces that only the root module can invoke it. Since Valdi_Widgets is the root module (not Valdi), we must declare and configure the extension here. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The toolchains_llvm extension enforces root-module-only usage. When Valdi is a dependency (not root), its use_extension call fails. Patch it out of Valdi's MODULE.bazel and declare the extension from Valdi_Widgets (the actual root module) instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The --override_module flags bypass archive_override patches, so the llvm extension removal patch wasn't being applied. Patch the local Valdi clone directly via sed before running bazel. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Valdi's MODULE.bazel already declares the rules_ts extension with npm_typescript. Declaring it again from Valdi_Widgets causes a duplicate repo error. Keep only the bazel_dep for visibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
At commit 45b28375, three sub-module MODULE.bazel files are missing deps that were added later: snap_client_toolchains needs snap_platforms, android_macros needs rules_android, and rules_hdrs needs rules_pkg. Append the missing entries in the CI patch step. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The sub-module MODULE.bazel files may not end with a trailing newline, causing echo >> to concatenate on the same line. Use printf with a leading \n to ensure proper line separation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
android_macros already has bazel_dep(name = "rules_android") at the pinned commit — appending it again causes a duplicate repo name error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Root module toolchain registrations shadow dependency module registrations. Since Valdi (a dependency) registers Apple CC before LLVM for ObjC compilation priority, the root module must do the same or the LLVM toolchain (root-registered) will be selected for ObjC targets, which fails. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pin protobuf (27.0), rules_apple (4.0.0), rules_pkg (0.9.1), and zlib (1.3.2) to prevent MVS from escalating to incompatible versions when Valdi's own overrides are ignored as a non-root module. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
abseil-cpp headers use Clang nullability extensions that trigger -Werror in both target and exec (tool) configurations. Add the suppression flags matching Valdi's own .bazelrc. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Switch from commit SHA to release tag (beta-0.1.0) for Valdi pinning. Replace manual Apple CC + LLVM toolchain setup with Valdi's unified valdi_toolchains extension. Remove stale valdi_remove_llvm_extension patch. Add Valdi custom Bazel registry for patched deps (rules_swift, rules_kotlin, rules_android_ndk). Remove WORKSPACE (bzlmod only). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Bazel registry now provides pre-patched rules_swift, rules_kotlin, and rules_android_ndk. The valdi_toolchains extension handles LLVM setup so valdi_remove_llvm_extension.patch is also unnecessary. Only websocketpp.patch remains (still needed). Also drop refs/tags/ from the Valdi archive URL so branch names and commit SHAs work too (e.g. VALDI_TAG = "main" for bleeding edge). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
WORKSPACE was deleted in our branch (bzlmod migration) and modified on main. Keeping the deletion since we're bzlmod-only now. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The pinned commit predates the Bazel registry and missing bazel_dep fixes. Checking out main and passing --registry=file://$VALDI/registry gives CI access to pre-patched deps (rules_swift, websocketpp, etc.) without manual sed workarounds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The .bazelrc points at a registry URL for a release tag that may not exist yet. BCR (listed second) resolves rules_swift before the local registry appended via --registry CLI flag, so the unpatched version is used. Fix by sed-replacing the .bazelrc URL with file://$VALDI/registry so the patched registry is checked first. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ts_project in widgets/BUILD.bazel needs @npm_typescript, which is created by the rules_ts extension. Valdi declares its own, but bzlmod scopes use_repo to the declaring module — consumers must redeclare. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Valdi's MODULE.bazel already calls rules_ts_ext.deps() which creates the npm_typescript repo. In bzlmod, extension repos are global — a second .deps() tag causes a duplicate repo error. Widgets only needs use_repo to import the repo Valdi already creates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The public Valdi mirror doesn't include open_source_archives.bzl (Copybara strips it), but valdi_compiler_repos_extension.bzl loads it. Create an empty ARCHIVES stub so the extension falls back to empty repos — the compiler binaries are in the checkout path anyway. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
libresvg.a is tracked by git-lfs. Without lfs: true, the checkout gets 133-byte pointer files instead of actual binaries, causing "unknown file type" linker errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gioneill
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
beta-0.1.0)valdi_toolchainsextensionrefs/tags/from archive URLs so branch names and commit SHAs work too (e.g.VALDI_TAG = "main"for bleeding edge)rules_tsextension for@npm_typescriptvisibility (needed byts_projectin widgets).bazelrcregistry to local Valdi checkout, stubopen_source_archives.bzl, enable git-lfsTest plan
🤖 Generated with Claude Code