-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMODULE.bazel
More file actions
266 lines (239 loc) · 11.9 KB
/
Copy pathMODULE.bazel
File metadata and controls
266 lines (239 loc) · 11.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# Copyright 2025-2026 Stack AV Co.
# SPDX-License-Identifier: Apache-2.0
module(name = "clockwork")
LOCAL_PATH_OVERRIDE = "LOCAL_PATH_OVERRIDE"
PATCH = True
raw_dependencies = [
# keep-sorted start
("abseil-cpp", "20250814.2", PATCH),
("aspect_rules_js", "3.1.2", PATCH),
("aspect_rules_py", "1.1.0", PATCH),
("aspect_rules_ts", "3.8.6"),
("au", "https://github.com/aurora-opensource/au/archive/49e3e0e2b7cc67164379bce323761c260370f8f0.tar.gz", "sha256-OIW0rORwFwatWLVryCfPQNXRcwWvXzw3s70jF4zHDlk=", PATCH), # main
("aws_sdk", "1.11.758", PATCH),
("bazel_lib", "3.3.1", PATCH),
("bazel_skylib", "1.9.0"),
("bazel_skylib_gazelle_plugin", "1.9.0", PATCH),
("boost.accumulators", "https://github.com/boostorg/accumulators/archive/boost-1.90.0.tar.gz", "sha256-nVjWvGu8ET0O1PREGvYo5GWRlHGX3N9Nx7/pl1od6Zg=", PATCH),
("boost.asio", "1.90.0.bcr.1"),
("boost.beast", "1.90.0.bcr.1"),
("boost.container", "1.90.0.bcr.1"),
("boost.container_hash", "1.90.0.bcr.1"),
("boost.core", "1.90.0.bcr.1"),
("boost.fusion", "1.90.0.bcr.1"),
("boost.iterator", "1.90.0.bcr.1"),
("boost.json", "1.90.0.bcr.1"),
("boost.lexical_cast", "1.90.0.bcr.1"),
("boost.lockfree", "1.90.0.bcr.1"),
("boost.process", "1.90.0.bcr.1"),
("boost.system", "1.90.0.bcr.1"),
("build_stack_rules_proto", "https://github.com/stackb/rules_proto/archive/a19d9eed24a7d86ea2730053c4c8406ea5b9f304.tar.gz", "sha256-R1VtZ7mtU7ceWMoRkhi9/L0T0DfqY0lymJNi7wTs2DY=", PATCH), # v4.1.0
("buildifier_prebuilt", "8.5.1.2"),
("c-ares", "1.34.6"),
("catch2", "3.13.0", PATCH),
("clang", "https://github.com/stackav-oss/clockwork/releases/download/sysroot/clang_sysroot_5.tar.zst", "sha256-yM+5lByHZz8XE13oCfOnNqci3OPA5xHiM5XZGVJ/dAM="),
("com_github_nanopb_nanopb", "https://github.com/nanopb/nanopb/archive/cad3c18ef15a663e30e3e43e3a752b66378adec1.tar.gz", "sha256-EOXwFOkaVAlZzbgs5IaiX7mjacq++uEo2b2kzLNZjjA=", PATCH), # 0.4.9.1
("cpptrace", "https://github.com/jeremy-rifkin/cpptrace/archive/3db8da80111171c219ab5839905771386bee06b3.tar.gz", "sha256-d9aJ/XlW/4A1Ggedg+hqA4Zdu+JDO0VZzGzqUL7Xc5A=", PATCH), # v1.0.4
("curl", "8.12.0.bcr.1", PATCH),
("fltk", "https://github.com/rnortman/fltk/archive/8fd5ecf90cf94d2ae059c604b508f5b1fd32b359.tar.gz", "sha256-m/bmnztewWXOMoH8jLmIJre5GaAgTSefuzZhpYUzpm4=", PATCH), # main
("fmt", "12.1.0"),
("gazelle", "https://github.com/bazelbuild/bazel-gazelle/archive/b13c1573c378bb3dd9b9de1397db89d0392f8e72.tar.gz", "sha256-A9e1HrLDyVGTynKxrkgxx6qVUJ5hFv2HeUO4qHZsdJQ="), # v0.47.0
("grpc", "1.82.1", PATCH),
("gsl", "https://github.com/microsoft/GSL/archive/caae4dd0f8343efb879369dcd08a2b18aae59f3b.tar.gz", "sha256-kC9qoNWR45WpjXt2EIW89slBCOwyx7VpddBZAYPp4FQ=", PATCH), # main
("liburing", "https://github.com/axboe/liburing/archive/298c083d75ecde5a8833366167b3b6abff0c8d39.tar.gz", "sha256-n+yjnxXRqt4CYyOiPbQIXBN36tqYJTE1lErqk+B7DO8=", PATCH), # liburing-2.4
("lz4", "1.10.0.bcr.1"),
("mcap", "https://github.com/foxglove/mcap/archive/fa382a06f852bd4b90046ab74b30c11b0a089d9b.tar.gz", "sha256-UTtv2orRxfqtxV3C3/E9ipCanyhfUhlIK0EA1B6sq0E=", PATCH), # releases/mcap-cli/v0.0.61
("nanobind", "https://github.com/wjakob/nanobind/archive/784efa2a0358a4dc5432c74f5685ee026e20f2b6.tar.gz", "sha256-LzMYkZxpueCDxOVXcUQXMAQk1gJaN68A2La5yI3TZLM=", PATCH), # v2.2.0
("openssl", "3.5.5.bcr.4"),
("opentelemetry-cpp", "1.24.0.bcr.1", PATCH),
("platforms", "1.1.0"),
("protobuf", "35.1", PATCH),
("protoc-gen-validate", "1.3.0"), # indirect dependency from go's xds
("re2", "2021-09-01"),
("robin-map", "1.4.0"),
("rules_appimage", "1.20.0", PATCH),
("rules_cc", "0.2.18"),
("rules_go", "0.59.0", PATCH),
("rules_java", "8.15.2"),
("rules_multirun", "0.13.0"),
("rules_proto", "7.1.0"),
("rules_proto_grpc", "5.8.0"),
("rules_proto_grpc_buf", "5.8.0"),
("rules_python", "2.2.0", PATCH),
("rules_python_gazelle_plugin", "2.2.0", PATCH),
("rules_shell", "0.8.0"),
("sha1", "https://github.com/vog/sha1/archive/3f8a4aa032d144309d00dbfe972906a49b3631b9.tar.gz", "sha256-SZA0GY0s3X34GXZqXJ42vXGBeOKykKr3N9sf/kIPsQs=", PATCH), # 1.4
("stardoc", "0.8.1"),
("tclap", "https://github.com/mirror/tclap/archive/61cfae16ceba4cadc3d74439fa1e9fd4fce16bc9.tar.gz", "sha256-BQK+wLqeEmXzBdHEEdvzBK9fqftcwRH353sWjIC5TRk=", PATCH), # 1.4
("tl_expected", "https://github.com/TartanLlama/expected/archive/1770e3559f2f6ea4a5fb4f577ad22aeb30fbd8e4.tar.gz", "sha256-jmZVvmFauN06UnRdVMjogljlilwO/kxBMwcqvoJBSIU=", PATCH), # v1.3.1
("trompeloeil", "https://github.com/rollbear/trompeloeil/archive/eaeb89c1ce9d354b0ba7eb921fd5712cdbd78adf.tar.gz", "sha256-1q26K1wajMl25h8frjR7lFoz11KtJE3Gp34YH4u7JI0=", PATCH), # v49
("upb", "0.0.0-20230907-e7430e6"),
("wise_enum", "https://github.com/quicknir/wise_enum/archive/34ac79f7ea2658a148359ce82508cc9301e31dd3.tar.gz", "sha256-cd3/QX7qdk2Rpsc4BPgk9zQ2BWjoO+8xn6lb+VIdi94=", PATCH), # 3.1.0
("xxhash", "https://github.com/Cyan4973/xxHash/archive/e626a72bc2321cd320e953a0ccf1584cad60f363.tar.gz", "sha256-NOccCFY2+8FyZIKZbZJxnQoW5qYJeXDs8pkKJ7OCEWI=", PATCH), # v0.8.3
("zstd", "1.5.7.bcr.1"),
# keep-sorted end
]
# Stretch everything out to be the same length so we can use list comprehensions normally.
DEPENDENCIES_NUM_FIELDS = 4
dependencies = [d + ((None,) * (DEPENDENCIES_NUM_FIELDS - len(d))) for d in raw_dependencies]
patch_strip = {
# keep-sorted start
# The rules_python Gazelle plugin is a subdir of the rules_python repo.
"rules_python_gazelle_plugin": 1,
# keep-sorted end
}
patch_cmds = {
# keep-sorted start block=yes
"protobuf": ["""find . -name *.h -print0 | xargs -0 sed -i'' -e '1 i\\\n#pragma GCC system_header'"""],
"wise_enum": [
# The docs say that we can have 256 enum items but we can only actually have 128.
# We need more than that in some places, so regenarate the header.
"""python3 create_generated.py 256 wise_enum_generated.h""",
],
# keep-sorted end
}
[bazel_dep(name = name) for name, _, _, _ in dependencies]
[archive_override(
module_name = name,
integrity = integrity,
patch_cmds = patch_cmds.get(name, []),
patches = ["//third_party/patches:" + name + ".patch"] if should_patch else [],
# GitHub tarballs have a top-level dir named after the repo and hash.
strip_prefix = url[len("https://github.com/"):-len(".tar.gz")].split(
"/",
maxsplit = 1,
)[1].replace("/archive/", "-"),
urls = [url],
) for name, url, integrity, should_patch in dependencies if (url.startswith("https://github.com/") and "/archive/" in url)]
[archive_override(
module_name = name,
# How could anyone have guessed this: https://github.com/bazelbuild/bazel/issues/17803
# To get checksum you need to pipe the file through `openssl dgst -sha256 -binary | openssl base64 -A` and prefix "sha256-"
integrity = integrity,
patch_cmds = patch_cmds.get(name, []),
patches = ["//third_party/patches:" + name + ".patch"] if should_patch else [],
urls = [url],
) for name, url, integrity, should_patch in dependencies if url.endswith((".tar.gz", ".tar.zst", ".tar.xz")) and not (url.startswith("https://github.com/") and "/archive/" in url)]
[local_path_override(
module_name = lib,
path = ("third_party/" + lib) if custom_path == None else custom_path,
) for lib, remote, custom_path, _ in dependencies if remote == LOCAL_PATH_OVERRIDE]
[single_version_override(
module_name = name,
patch_cmds = patch_cmds.get(name, []),
patch_strip = patch_strip.get(name, 0),
patches = ["//third_party/patches:" + name + ".patch"] if should_patch else [],
version = version,
) for name, version, should_patch, _ in dependencies if not version.endswith((".git", ".tar.gz", ".tar.zst", ".tar.xz", LOCAL_PATH_OVERRIDE))]
register_toolchains(
"@clang//:clang-aarch64-gnu-linux",
"@clang//:clang-x86_64-gnu-linux",
dev_dependency = True,
)
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.defaults(python_version = "3.12")
python.toolchain(
configure_coverage_tool = True,
ignore_root_user_error = True,
python_version = "3.10",
)
python.toolchain(
configure_coverage_tool = True,
ignore_root_user_error = True,
python_version = "3.12",
)
use_repo(python, "python_3_10")
use_repo(python, "python_3_12")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.whl_mods(
# Works around this issue https://github.com/bazelbuild/rules_python/issues/1000
additive_build_content = """
filegroup(
name = "bin_uv",
srcs = ["bin/uv"],
)
""",
data = [":bin_uv"],
hub_name = "clockwork_whl_mods_hub",
whl_name = "uv",
)
use_repo(pip, "clockwork_whl_mods_hub")
# Shared configuration for the dual-parsed `@clockwork_pip` hub (3.10 + 3.12).
CLOCKWORK_PIP_HUB_ALIASES = {"uv": ["bin_uv"]}
CLOCKWORK_PIP_WHL_MODIFICATIONS = {
# keep-sorted start
"@clockwork_whl_mods_hub//:uv.json": "uv",
# keep-sorted end
}
# Target platforms for cross-platform wheel resolution under rules_python 2.0.
# Applied uniformly to every `pip.parse()` invocation below.
CLOCKWORK_PIP_TARGET_PLATFORMS = [
"linux_x86_64",
"linux_aarch64",
]
# The default conversion of native namespace packages into pkg-util namespace packages by automatically generating
# __init__.py files in every directory breaks pyrefly's import resolution for type-checking, so we set
# enable_implicit_namespace_pkgs = True on all pip.parse calls.
#
# After the 3.10->3.12 flip, `requirements_3_12.txt` is the primary lock.
# TODO(DX-29): Once py_3_10_* consumers are removed, drop the 3.10 compat entry below.
CLOCKWORK_PIP_HUBS = [
{
"extra_hub_aliases": CLOCKWORK_PIP_HUB_ALIASES,
"hub_name": "clockwork_pip",
"python_version": "3.12",
"requirements_lock": "//tools/language_support:requirements_3_12.txt",
"whl_modifications": CLOCKWORK_PIP_WHL_MODIFICATIONS,
},
# Compatibility parse for py_3_10_* transitions.
# TODO(DX-29): retire once all py_3_10_* consumers are migrated away.
{
"extra_hub_aliases": CLOCKWORK_PIP_HUB_ALIASES,
"hub_name": "clockwork_pip",
"python_version": "3.10",
"requirements_lock": "//tools/language_support:requirements_3_10.txt",
"whl_modifications": CLOCKWORK_PIP_WHL_MODIFICATIONS,
},
{
"hub_name": "clockwork_pip310",
"python_version": "3.10",
"requirements_lock": "//tools/language_support:requirements_pip310.txt",
},
]
[pip.parse(
enable_implicit_namespace_pkgs = True,
extra_hub_aliases = hub.get("extra_hub_aliases", {}),
hub_name = hub["hub_name"],
python_version = hub["python_version"],
requirements_lock = hub["requirements_lock"],
target_platforms = CLOCKWORK_PIP_TARGET_PLATFORMS,
whl_modifications = hub.get("whl_modifications", {}),
) for hub in CLOCKWORK_PIP_HUBS]
use_repo(pip, "clockwork_pip")
use_repo(pip, "clockwork_pip310")
## Protobuf
register_toolchains("@build_stack_rules_proto//toolchain:standard")
# golang
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.nogo(nogo = "//tools/golang:clockwork_nogo")
go_sdk.from_file(go_mod = "//:go.mod")
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(
go_deps,
# keep-sorted start
"com_github_bazelbuild_buildtools",
"com_github_emirpasic_gods",
"com_github_stretchr_testify",
"org_golang_google_genproto_googleapis_api",
"org_golang_google_protobuf",
"org_skia_go_infra",
# keep-sorted end
)
go_deps_dev = use_extension("@gazelle//:extensions.bzl", "go_deps", dev_dependency = True)
go_deps_dev.module_override(
patches = ["third_party/patches/go_tree_sitter.patch"],
path = "github.com/smacker/go-tree-sitter",
)
root_repo = use_extension("//tools/repo:root_repo.bzl", "root_repo")
use_repo(root_repo, "root_repo")