Skip to content

Commit 93cdf3f

Browse files
authored
refactor: use normal devdeps pattern (#774)
- Root MODULE.bazel has "conditional devdeps" for everything below the cutline - Nested modules are expected to behave correctly as they use a prerelease, so these will see everything as real dep - BCR patch is now just a single line, changing a constant from False to True - replace aspect_bazel_lib 2.x `load`s with bazel_lib 3.x
1 parent d226ea7 commit 93cdf3f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+199
-801
lines changed

.bcr/patches/remove_dev_deps.patch

Lines changed: 5 additions & 256 deletions
Original file line numberDiff line numberDiff line change
@@ -1,256 +1,5 @@
1-
--- a/MODULE.bazel 2026-01-07 20:51:31
2-
+++ b/MODULE.bazel 2026-01-07 20:51:31
3-
@@ -58,253 +58,3 @@
4-
# HACK: In prod the includer's patch inserts the use_repo for multitool. This
5-
# solves the problem of needing a use_repo here in prod and below in dev.
6-
7-
-################################################################################
8-
-# Dev deps
9-
-#
10-
-# This is what we wish the MODULE.bazel looked like.
11-
-#
12-
-# See https://github.com/bazelbuild/bazel/issues/27137, we can't do e2e tests
13-
-# with includes.
14-
-#
15-
-# As a workaround this block is expanded using tools/bazel/includer.py as part of
16-
-# pre-commit. Do NOT add directly to the below content as it will be replaced.
17-
-# Instead add an include directive, or add to one of the included files.
18-
-#
19-
-# The included content is truncated off in release. Production dependencies MUST
20-
-# be specified directly in the MODULE.bazel file as is conventional.
21-
-#
22-
-# include("//bazel/include:llvm.MODULE.bazel")
23-
-# include("//bazel/include:rust.MODULE.bazel")
24-
-# include("//bazel/include:cargo.MODULE.bazel")
25-
-# include("//bazel/include:test.MODULE.bazel")
26-
-# include("//bazel/include:oci.MODULE.bazel")
27-
-# include("//bazel/include:python.MODULE.bazel")
28-
-# include("//bazel/include:release.MODULE.bazel")
29-
-# include("//bazel/include:multitool.MODULE.bazel")
30-
-# include("//bazel/include:tools.MODULE.bazel")
31-
-
32-
-################################################################################
33-
-# Begin included content
34-
-
35-
-########################################
36-
-# from bazel/include/llvm.MODULE.bazel
37-
-# LLVM configuration
38-
-
39-
-bazel_dep(name = "toolchains_llvm_bootstrapped", version = "0.2.5", dev_dependency = True)
40-
-archive_override(
41-
- module_name = "toolchains_llvm_bootstrapped",
42-
- integrity = "sha256-+nddimV34BYO8YExiKLYG2kMoA2Sv+5ZoMRPQLJxNfE=",
43-
- patch_strip = 1,
44-
- patches = [
45-
- "//bazel/patches:llvm_darwin_sysroot.patch",
46-
- ],
47-
- strip_prefix = "toolchains_llvm_bootstrapped-121c8419394e76b5652c161369743c564799b2e3",
48-
- urls = ["https://github.com/cerisier/toolchains_llvm_bootstrapped/archive/121c8419394e76b5652c161369743c564799b2e3/master.tar.gz"],
49-
-)
50-
-
51-
-register_toolchains(
52-
- "@toolchains_llvm_bootstrapped//toolchain:all",
53-
- dev_dependency = True,
54-
-)
55-
-
56-
-########################################
57-
-# from bazel/include/rust.MODULE.bazel
58-
-# Rust configuration
59-
-
60-
-bazel_dep(name = "rules_rust", version = "0.68.1")
61-
-
62-
-rust = use_extension(
63-
- "@rules_rust//rust:extensions.bzl",
64-
- "rust",
65-
-)
66-
-rust.toolchain(
67-
- edition = "2024",
68-
- extra_target_triples = [
69-
- "aarch64-apple-darwin",
70-
- "x86_64-apple-darwin",
71-
- "aarch64-unknown-linux-musl",
72-
- "x86_64-unknown-linux-musl",
73-
- ],
74-
- versions = ["1.88.0"],
75-
-)
76-
-use_repo(rust, "rust_toolchains")
77-
-
78-
-register_toolchains("@rust_toolchains//:all")
79-
-
80-
-########################################
81-
-# from bazel/include/cargo.MODULE.bazel
82-
-# Separate from the Rust config so that we can reuse Rust in e2e testing whereas
83-
-# the cargo config is root repo specific.
84-
-
85-
-bazel_dep(name = "xz", version = "5.4.5.bcr.5")
86-
-bazel_dep(name = "zstd", version = "1.5.7")
87-
-bazel_dep(name = "bzip2", version = "1.0.8.bcr.3")
88-
-bazel_dep(name = "rules_rs", version = "0.0.16")
89-
-
90-
-crate = use_extension(
91-
- "@rules_rs//rs:extensions.bzl",
92-
- "crate",
93-
-)
94-
-crate.from_cargo(
95-
- name = "crates",
96-
- cargo_lock = "//:Cargo.lock",
97-
- cargo_toml = "//:Cargo.toml",
98-
- platform_triples = [
99-
- "aarch64-apple-darwin",
100-
- "aarch64-unknown-linux-musl",
101-
- "x86_64-apple-darwin",
102-
- "x86_64-unknown-linux-musl",
103-
- ],
104-
-)
105-
-crate.annotation(
106-
- crate = "backtrace",
107-
- # This just compiles code on Android, we don't need it.
108-
- gen_build_script = "off",
109-
- repositories = ["crates"],
110-
-)
111-
-crate.annotation(
112-
- crate = "zstd-sys",
113-
- # This build script is naughty and tries to depend on system zstd or build it from source.
114-
- gen_build_script = "off",
115-
- repositories = ["crates"],
116-
- deps = ["@@zstd+//:zstd"],
117-
-)
118-
-crate.annotation(
119-
- crate = "bzip2-sys",
120-
- gen_build_script = "off",
121-
- repositories = ["crates"],
122-
- deps = ["@@bzip2+//:bz2"],
123-
-)
124-
-crate.annotation(
125-
- crate = "lzma-sys",
126-
- gen_build_script = "off",
127-
- repositories = ["crates"],
128-
- deps = ["@@xz+//:lzma"],
129-
-)
130-
-use_repo(crate, "crates")
131-
-
132-
-########################################
133-
-# from bazel/include/test.MODULE.bazel
134-
-# TODO: Replace with bazel_features?
135-
-# cf. https://github.com/bazel-contrib/bazelrc-preset.bzl/blob/main/MODULE.bazel#L8C1-L10C70
136-
-bazel_dep(name = "rules_shell", version = "0.6.1")
137-
-
138-
-version = use_extension("@bazel_features//private:extensions.bzl", "version_extension")
139-
-use_repo(version, "bazel_features_globals", "bazel_features_version")
140-
-
141-
-########################################
142-
-# from bazel/include/oci.MODULE.bazel
143-
-# rules_oci and friends
144-
-bazel_dep(name = "rules_oci", version = "2.2.6", dev_dependency = True)
145-
-
146-
-oci = use_extension("@rules_oci//oci:extensions.bzl", "oci", dev_dependency = True)
147-
-oci.pull(
148-
- name = "ubuntu",
149-
- digest = "sha256:c35e29c9450151419d9448b0fd75374fec4fff364a27f176fb458d472dfc9e54",
150-
- image = "public.ecr.aws/docker/library/ubuntu",
151-
- platforms = [
152-
- "linux/arm64/v8",
153-
- "linux/amd64",
154-
- ],
155-
- tag = "latest",
156-
-)
157-
-use_repo(oci, "ubuntu", "ubuntu_linux_amd64", "ubuntu_linux_arm64_v8")
158-
-
159-
-# For building test images with py_image_layer
160-
-bazel_dep(name = "container_structure_test", version = "1.19.3", dev_dependency = True)
161-
-git_override(
162-
- module_name = "container_structure_test",
163-
- commit = "63ee63e15fae64f00b1c1ace1eb5cc99251b9e02",
164-
- remote = "https://github.com/GoogleContainerTools/container-structure-test.git",
165-
-)
166-
-
167-
-########################################
168-
-# from bazel/include/python.MODULE.bazel
169-
-# rules_python and friends
170-
-# Note that we dep on rules_python as part of the prod deps, not here
171-
-bazel_dep(name = "rules_python_gazelle_plugin", version = "1.0.0")
172-
-
173-
-python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True)
174-
-python.toolchain(
175-
- is_default = True,
176-
- python_version = "3.9",
177-
-)
178-
-python.toolchain(
179-
- is_default = False,
180-
- python_version = "3.12",
181-
-)
182-
-
183-
-# We still use pip for testing the virtual deps machinery
184-
-pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True)
185-
-pip.parse(
186-
- hub_name = "django",
187-
- python_version = "3.9",
188-
- requirements_lock = "//py/tests/virtual/django:requirements.txt",
189-
-)
190-
-use_repo(pip, "django")
191-
-
192-
-# For everything else, we use our own uv machinery
193-
-uv = use_extension("//uv/unstable:extension.bzl", "uv", dev_dependency = True)
194-
-uv.declare_hub(
195-
- hub_name = "pypi",
196-
-)
197-
-uv.declare_venv(
198-
- hub_name = "pypi",
199-
- venv_name = "default",
200-
-)
201-
-uv.lockfile(
202-
- src = "//:uv.lock",
203-
- hub_name = "pypi",
204-
- venv_name = "default",
205-
-)
206-
-uv.unstable_annotate_requirements(
207-
- src = "//:annotations.toml",
208-
- hub_name = "pypi",
209-
- venv_name = "default",
210-
-)
211-
-use_repo(uv, "pypi")
212-
-
213-
-http_file = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
214-
-
215-
-http_file(
216-
- name = "django_4_2_4",
217-
- downloaded_file_path = "Django-4.2.4-py3-none-any.whl",
218-
- sha256 = "860ae6a138a238fc4f22c99b52f3ead982bb4b1aad8c0122bcd8c8a3a02e409d",
219-
- urls = ["https://files.pythonhosted.org/packages/7f/9e/fc6bab255ae10bc57fa2f65646eace3d5405fbb7f5678b90140052d1db0f/Django-4.2.4-py3-none-any.whl"],
220-
-)
221-
-
222-
-http_file(
223-
- name = "django_4_1_10",
224-
- downloaded_file_path = "Django-4.1.10-py3-none-any.whl",
225-
- sha256 = "26d0260c2fb8121009e62ffc548b2398dea2522b6454208a852fb0ef264c206c",
226-
- urls = ["https://files.pythonhosted.org/packages/34/25/8a218de57fc9853297a1a8e4927688eff8107d5bc6dcf6c964c59801f036/Django-4.1.10-py3-none-any.whl"],
227-
-)
228-
-
229-
-http_file(
230-
- name = "sqlparse_0_4_0",
231-
- downloaded_file_path = "sqlparse-0.4.0-py3-none-any.whl",
232-
- sha256 = "0523026398aea9c8b5f7a4a6d5c0829c285b4fbd960c17b5967a369342e21e01",
233-
- urls = ["https://files.pythonhosted.org/packages/10/96/36c136013c4a6ecb8c6aa3eed66e6dcea838f85fd80e1446499f1dabfac7/sqlparse-0.4.0-py3-none-any.whl"],
234-
-)
235-
-
236-
-########################################
237-
-# from bazel/include/release.MODULE.bazel
238-
-bazel_dep(name = "rules_pkg", version = "1.1.0")
239-
-
240-
-########################################
241-
-# from bazel/include/multitool.MODULE.bazel
242-
-# Multitool configuration
243-
-
244-
-# Multitool is a prod dep (for now) so we don't need this
245-
-bazel_dep(name = "rules_multitool", version = "1.9.0")
246-
-
247-
-multitool = use_extension("@rules_multitool//multitool:extension.bzl", "multitool")
248-
-multitool.hub(lockfile = "//tools:tools.lock.json")
249-
-use_repo(multitool, "multitool")
250-
-
251-
-########################################
252-
-# from bazel/include/tools.MODULE.bazel
253-
-# Local tools
254-
-bazel_dep(name = "bazelrc-preset.bzl", version = "1.4.0")
255-
-bazel_dep(name = "bazel_env.bzl", version = "0.5.0")
256-
-bazel_dep(name = "gazelle", version = "0.45.0")
1+
--- a/MODULE.bazel
2+
+++ b/MODULE.bazel
3+
@@ -9,1 +9,1 @@
4+
-IS_RELEASE = False
5+
+IS_RELEASE = True

.pre-commit-config.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ repos:
3434
3535
- repo: local
3636
hooks:
37-
- id: 00-sync-module-includes
38-
name: Update MODULE.bazel includes
39-
entry: /usr/bin/env python3 tools/bazel/includer.py
40-
language: script
41-
require_serial: true
42-
4337
- id: check-requirements-lock
4438
name: Update requirements lock
4539
# Note that we use a nested shell to discard $@, which is the file list

0 commit comments

Comments
 (0)