-
Notifications
You must be signed in to change notification settings - Fork 15.6k
/
Copy pathMODULE.bazel
187 lines (168 loc) · 6.84 KB
/
MODULE.bazel
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
# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel
# https://github.com/protocolbuffers/protobuf/issues/14313
module(
name = "protobuf",
version = "31.0-dev", # Automatically updated on release
compatibility_level = 1,
repo_name = "com_google_protobuf",
)
# LOWER BOUND dependency versions.
# Bzlmod follows MVS:
# https://bazel.build/versions/6.0.0/build/bzlmod#version-resolution
# Thus the highest version in their module graph is resolved.
# These dependencies must be declared before the other rules dependencies.
bazel_dep(name = "rules_apple", version = "3.13.0", repo_name = "build_bazel_rules_apple")
bazel_dep(name = "apple_support", version = "1.15.1", repo_name = "build_bazel_apple_support")
#ifndef PROTO2_OPENSOURCE
# LINT.IfChange
#endif // PROTO2_OPENSOURCE
# protoc dependencies
bazel_dep(name = "abseil-cpp", version = "20250127.0")
bazel_dep(name = "rules_cc", version = "0.0.17")
bazel_dep(name = "zlib", version = "1.3.1.bcr.5")
#ifndef PROTO2_OPENSOURCE
# LINT.ThenChange(//depot/google3/third_party/protobuf/compiler/notices.h)
#endif // PROTO2_OPENSOURCE
# other dependencies
bazel_dep(name = "bazel_features", version = "1.23.0", repo_name = "proto_bazel_features")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "jsoncpp", version = "1.9.6")
bazel_dep(name = "rules_fuzzing", version = "0.5.2")
bazel_dep(name = "rules_java", version = "8.6.1")
bazel_dep(name = "rules_jvm_external", version = "6.3")
bazel_dep(name = "rules_kotlin", version = "1.9.6")
bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_python", version = "1.0.0")
bazel_dep(name = "rules_rust", version = "0.51.0")
bazel_dep(name = "rules_ruby", version = "0.17.3", dev_dependency=True)
# Workaround for https://github.com/bazel-contrib/rules_ruby/issues/216
# Patch rules_ruby to disable automatic attempt to install bundler. When fixed,
# delete Disable_bundle_install.patch and single_version_override() below.
single_version_override(
module_name = "rules_ruby",
patch_strip = 1,
patches = [
"@com_google_protobuf//:Disable_bundle_install.patch",
],
version = "0.17.3",
)
bazel_dep(name = "rules_shell", version = "0.2.0")
bazel_dep(name = "platforms", version = "0.0.10")
# Ruby toolchains
ruby = use_extension("@rules_ruby//ruby:extensions.bzl", "ruby", dev_dependency=True)
ruby.toolchain(
name = "ruby",
version = "system",
)
use_repo(ruby, "ruby")
ruby.bundle_fetch(
name = "protobuf_bundle",
gem_checksums = {
"bigdecimal-3.1.9": "2ffc742031521ad69c2dfc815a98e426a230a3d22aeac1995826a75dabfad8cc",
"bigdecimal-3.1.9-java": "dd9b8f7c870664cd9538a1325ce385ba57a6627969177258c4f0e661a7be4456",
"ffi-1.17.1": "26f6b0dbd1101e6ffc09d3ca640b2a21840cc52731ad8a7ded9fb89e5fb0fc39",
"ffi-1.17.1-java": "2546e11f9592e2b9b6de49eb96d2a378da47b0bb8469d5cbc9881a55c0d55da7",
"ffi-compiler-1.3.2": "a94f3d81d12caf5c5d4ecf13980a70d0aeaa72268f3b9cc13358bcc6509184a0",
"power_assert-2.0.5": "63b511b85bb8ea57336d25156864498644f5bbf028699ceda27949e0125bc323",
"rake-13.2.1": "46cb38dae65d7d74b6020a4ac9d48afed8eb8149c040eccf0523bec91907059d",
"rake-compiler-1.1.9": "51b5c95a1ff25cabaaf92e674a2bed847ab53d66302fc8843830df46ab1f51f5",
"rake-compiler-dock-1.2.1": "3cc968d7ffc923c0e775b28d79a3389efb3d2b16ef52ed0298fbc97d347e5878",
"test-unit-3.6.7": "c342bb9f7334ea84a361b43c20b063f405c0bf3c7dbe3ff38f61a91661d29221"
},
gemfile = "//ruby:Gemfile",
gemfile_lock = "//ruby:Gemfile.lock",
)
use_repo(ruby, "protobuf_bundle", "ruby_toolchains")
register_toolchains("@ruby_toolchains//:all", dev_dependency=True)
# Proto toolchains
register_toolchains("//bazel/private/toolchains:all")
SUPPORTED_PYTHON_VERSIONS = [
"3.9",
"3.10",
"3.11",
"3.12",
]
# TODO: Support hermetic / system python in bzlmod.
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
[
python.toolchain(
# Disable root warning for .pyc cache misses since CI runs as root.
# See https://github.com/bazelbuild/rules_python/pull/713
ignore_root_user_error = True,
is_default = python_version == SUPPORTED_PYTHON_VERSIONS[-1],
python_version = python_version,
)
for python_version in SUPPORTED_PYTHON_VERSIONS
]
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True)
[
pip.parse(
hub_name = "protobuf_pip_deps",
python_version = python_version,
requirements_lock = "//python:requirements.txt",
)
for python_version in SUPPORTED_PYTHON_VERSIONS
]
use_repo(pip, "protobuf_pip_deps")
crate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate", dev_dependency = True)
crate.spec(
package = "googletest",
version = ">0.0.0",
)
crate.spec(
package = "paste",
version = ">=1",
)
crate.from_specs()
use_repo(crate, crate_index = "crates")
protobuf_maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven", dev_dependency = True)
protobuf_maven.install(
name = "protobuf_maven",
artifacts = [
"com.google.caliper:caliper:1.0-beta-3",
"com.google.guava:guava-testlib:32.0.1-jre",
"com.google.testparameterinjector:test-parameter-injector:1.18",
"com.google.truth:truth:1.1.2",
"junit:junit:4.13.2",
"org.mockito:mockito-core:4.3.1",
"biz.aQute.bnd:biz.aQute.bndlib:6.4.0",
"info.picocli:picocli:4.6.3",
],
repositories = [
"https://repo1.maven.org/maven2",
"https://repo.maven.apache.org/maven2",
],
)
use_repo(protobuf_maven, "protobuf_maven")
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
name = "maven",
artifacts = [
"com.google.code.findbugs:jsr305:3.0.2",
"com.google.code.gson:gson:2.8.9",
"com.google.errorprone:error_prone_annotations:2.5.1",
"com.google.j2objc:j2objc-annotations:2.8",
"com.google.guava:guava:32.0.1-jre",
],
repositories = [
"https://repo1.maven.org/maven2",
"https://repo.maven.apache.org/maven2",
],
)
use_repo(maven, "maven")
# Development dependencies
bazel_dep(name = "googletest", version = "1.15.2", dev_dependency = True)
bazel_dep(name = "rules_buf", version = "0.3.0", dev_dependency = True)
bazel_dep(name = "rules_testing", version = "0.6.0", dev_dependency = True)
bazel_dep(
name = "abseil-py",
version = "2.1.0",
dev_dependency = True,
repo_name = "com_google_absl_py",
)
# For clang-cl configuration
cc_configure = use_extension("@rules_cc//cc:extensions.bzl", "cc_configure_extension")
use_repo(cc_configure, "local_config_cc")
# rules_proto are needed for @com_google_protobuf_v25.0 used in //compatibility/... tests
bazel_dep(name = "rules_proto", version = "7.0.2", dev_dependency = True)