• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel
2# https://github.com/protocolbuffers/protobuf/issues/14313
3
4module(
5    name = "protobuf",
6    version = "29.4",  # Automatically updated on release
7    compatibility_level = 1,
8    repo_name = "com_google_protobuf",
9)
10
11# LOWER BOUND dependency versions.
12# Bzlmod follows MVS:
13# https://bazel.build/versions/6.0.0/build/bzlmod#version-resolution
14# Thus the highest version in their module graph is resolved.
15bazel_dep(
16    name = "abseil-cpp",
17    version = "20230802.0.bcr.1",
18    repo_name = "com_google_absl",
19)
20
21bazel_dep(
22    name = "bazel_skylib",
23    version = "1.7.0",
24)
25
26bazel_dep(
27    name = "jsoncpp",
28    version = "1.9.5",
29)
30
31bazel_dep(
32    name = "rules_cc",
33    version = "0.0.16",
34)
35
36bazel_dep(
37    name = "rules_fuzzing",
38    version = "0.5.2",
39)
40
41bazel_dep(
42    name = "rules_java",
43    version = "7.12.2",
44)
45
46bazel_dep(
47    name = "rules_jvm_external",
48    version = "6.3",
49)
50
51bazel_dep(
52    name = "rules_kotlin",
53    version = "1.9.6",
54)
55
56bazel_dep(
57    name = "rules_license",
58    version = "1.0.0",
59)
60
61bazel_dep(
62    name = "rules_pkg",
63    version = "1.0.1",
64)
65
66bazel_dep(
67    name = "rules_python",
68    version = "0.28.0",
69)
70
71bazel_dep(
72    name = "platforms",
73    version = "0.0.8",
74)
75
76bazel_dep(
77    name = "zlib",
78    version = "1.3.1",
79)
80
81bazel_dep(
82    name = "bazel_features",
83    version = "1.17.0",
84    repo_name = "proto_bazel_features",
85)
86
87bazel_dep(
88    name = "rules_shell",
89    version = "0.2.0"
90)
91
92# Proto toolchains
93register_toolchains("//bazel/private/toolchains:all")
94
95SUPPORTED_PYTHON_VERSIONS = [
96    "3.8",
97    "3.9",
98    "3.10",
99    "3.11",
100    "3.12",
101]
102
103python = use_extension("@rules_python//python/extensions:python.bzl", "python")
104
105[
106    python.toolchain(
107        is_default = python_version == SUPPORTED_PYTHON_VERSIONS[-1],
108        python_version = python_version,
109    )
110    for python_version in SUPPORTED_PYTHON_VERSIONS
111]
112
113use_repo(
114    python,
115    system_python = "python_{}".format(SUPPORTED_PYTHON_VERSIONS[-1].replace(".", "_")),
116)
117
118pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
119
120[
121    pip.parse(
122        hub_name = "pip_deps",
123        python_version = python_version,
124        requirements_lock = "//python:requirements.txt",
125    )
126    for python_version in SUPPORTED_PYTHON_VERSIONS
127]
128
129use_repo(pip, "pip_deps")
130
131maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
132
133maven.install(
134    name = "protobuf_maven",
135    artifacts = [
136        "com.google.caliper:caliper:1.0-beta-3",
137        "com.google.code.findbugs:jsr305:3.0.2",
138        "com.google.code.gson:gson:2.8.9",
139        "com.google.errorprone:error_prone_annotations:2.5.1",
140        "com.google.j2objc:j2objc-annotations:2.8",
141        "com.google.guava:guava:32.0.1-jre",
142        "com.google.guava:guava-testlib:32.0.1-jre",
143        "com.google.truth:truth:1.1.2",
144        "junit:junit:4.13.2",
145        "org.mockito:mockito-core:4.3.1",
146        "biz.aQute.bnd:biz.aQute.bndlib:6.4.0",
147        "info.picocli:picocli:4.6.3",
148    ],
149    repositories = [
150        "https://repo1.maven.org/maven2",
151        "https://repo.maven.apache.org/maven2",
152    ],
153)
154
155use_repo(maven, "protobuf_maven")
156
157# Development dependencies
158bazel_dep(
159    name = "googletest",
160    version = "1.14.0",
161    dev_dependency = True,
162    repo_name = "com_google_googletest",
163)
164
165bazel_dep(
166    name = "rules_buf",
167    version = "0.3.0",
168    dev_dependency = True,
169)
170
171bazel_dep(
172    name = "rules_testing",
173    version = "0.6.0",
174    dev_dependency = True,
175)
176
177# rules_proto are needed for @com_google_protobuf_v25.0 used in //compatibility/... tests
178bazel_dep(
179    name = "rules_proto",
180    version = "4.0.0",
181    dev_dependency = True,
182)
183