1workspace(name = "com_google_protobuf") 2 3# An explicit self-reference to work around changes in Bazel 7.0 4# See https://github.com/bazelbuild/bazel/issues/19973#issuecomment-1787814450 5# buildifier: disable=duplicated-name 6local_repository(name = "com_google_protobuf", path = ".") 7 8load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 9 10local_repository( 11 name = "com_google_protobuf_examples", 12 path = "examples", 13) 14 15# Load common dependencies first to ensure we use the correct version 16load("//:protobuf_deps.bzl", "PROTOBUF_MAVEN_ARTIFACTS", "protobuf_deps") 17 18protobuf_deps() 19 20load("@rules_python//python:repositories.bzl", "py_repositories") 21 22py_repositories() 23 24load("@rules_python//python/pip_install:repositories.bzl", "pip_install_dependencies") 25 26pip_install_dependencies() 27 28# Bazel platform rules. 29http_archive( 30 name = "platforms", 31 urls = [ 32 "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz", 33 "https://github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz", 34 ], 35 sha256 = "3a561c99e7bdbe9173aa653fd579fe849f1d8d67395780ab4770b1f381431d51", 36) 37 38http_archive( 39 name = "com_google_googletest", 40 sha256 = "7315acb6bf10e99f332c8a43f00d5fbb1ee6ca48c52f6b936991b216c586aaad", 41 strip_prefix = "googletest-1.15.0", 42 urls = [ 43 "https://github.com/google/googletest/releases/download/v1.15.0/googletest-1.15.0.tar.gz" # 2024-07-15 44 ], 45) 46 47load("@com_google_googletest//:googletest_deps.bzl", "googletest_deps") 48 49googletest_deps() 50 51load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps") 52 53rules_jvm_external_deps() 54 55load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup") 56 57rules_jvm_external_setup() 58 59load("@rules_jvm_external//:defs.bzl", "maven_install") 60 61maven_install( 62 name = "protobuf_maven", 63 artifacts = PROTOBUF_MAVEN_ARTIFACTS, 64 # For updating instructions, see: 65 # https://github.com/bazelbuild/rules_jvm_external#updating-maven_installjson 66 maven_install_json = "//:maven_install.json", 67 repositories = [ 68 "https://repo1.maven.org/maven2", 69 "https://repo.maven.apache.org/maven2", 70 ], 71) 72 73load("@protobuf_maven//:defs.bzl", "pinned_maven_install") 74 75pinned_maven_install() 76 77# For `cc_proto_blacklist_test` and `build_test`. 78load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") 79 80bazel_skylib_workspace() 81 82load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") 83 84rules_pkg_dependencies() 85 86load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies") 87 88apple_rules_dependencies() 89 90load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") 91 92apple_support_dependencies() 93 94load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") 95 96rules_java_dependencies() 97 98rules_java_toolchains() 99 100load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies") 101 102rules_cc_dependencies() 103 104# For `kt_jvm_library` 105load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories") 106 107kotlin_repositories() 108 109load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") 110 111kt_register_toolchains() 112 113http_archive( 114 name = "rules_ruby", 115 urls = [ 116 "https://github.com/protocolbuffers/rules_ruby/archive/b7f3e9756f3c45527be27bc38840d5a1ba690436.zip" 117 ], 118 strip_prefix = "rules_ruby-b7f3e9756f3c45527be27bc38840d5a1ba690436", 119 sha256 = "347927fd8de6132099fcdc58e8f7eab7bde4eb2fd424546b9cd4f1c6f8f8bad8", 120) 121 122load("@rules_ruby//ruby:defs.bzl", "ruby_runtime") 123 124ruby_runtime("system_ruby") 125 126register_toolchains("@system_ruby//:toolchain") 127 128# Uncomment pairs of ruby_runtime() + register_toolchain() calls below to enable 129# local JRuby testing. Do not submit the changes (due to impact on test duration 130# for non JRuby builds due to downloading JRuby SDKs). 131#ruby_runtime("jruby-9.2") 132# 133#register_toolchains("@jruby-9.2//:toolchain") 134# 135#ruby_runtime("jruby-9.3") 136# 137#register_toolchains("@jruby-9.3//:toolchain") 138 139load("@system_ruby//:bundle.bzl", "ruby_bundle") 140 141ruby_bundle( 142 name = "protobuf_bundle", 143 srcs = ["//ruby:google-protobuf.gemspec"], 144 gemfile = "//ruby:Gemfile", 145) 146 147http_archive( 148 name = "lua", 149 build_file = "//python/dist:lua.BUILD", 150 sha256 = "b9e2e4aad6789b3b63a056d442f7b39f0ecfca3ae0f1fc0ae4e9614401b69f4b", 151 strip_prefix = "lua-5.2.4", 152 urls = [ 153 "https://mirror.bazel.build/www.lua.org/ftp/lua-5.2.4.tar.gz", 154 "https://www.lua.org/ftp/lua-5.2.4.tar.gz", 155 ], 156) 157 158http_archive( 159 name = "com_github_google_benchmark", 160 urls = ["https://github.com/google/benchmark/archive/0baacde3618ca617da95375e0af13ce1baadea47.zip"], 161 strip_prefix = "benchmark-0baacde3618ca617da95375e0af13ce1baadea47", 162 sha256 = "62e2f2e6d8a744d67e4bbc212fcfd06647080de4253c97ad5c6749e09faf2cb0", 163) 164 165http_archive( 166 name = "com_google_googleapis", 167 urls = ["https://github.com/googleapis/googleapis/archive/d81d0b9e6993d6ab425dff4d7c3d05fb2e59fa57.zip"], 168 strip_prefix = "googleapis-d81d0b9e6993d6ab425dff4d7c3d05fb2e59fa57", 169 sha256 = "d986023c3d8d2e1b161e9361366669cac9fb97c2a07e656c2548aca389248bb4", 170 build_file = "//benchmarks:BUILD.googleapis", 171 patch_cmds = ["find google -type f -name BUILD.bazel -delete"], 172) 173 174load("@system_python//:pip.bzl", "pip_parse") 175 176pip_parse( 177 name = "pip_deps", 178 requirements = "//python:requirements.txt", 179) 180 181load("@pip_deps//:requirements.bzl", "install_deps") 182 183install_deps() 184 185http_archive( 186 name = "rules_fuzzing", 187 sha256 = "77206c54b71f4dd5335123a6ff2a8ea688eca5378d34b4838114dff71652cf26", 188 strip_prefix = "rules_fuzzing-0.5.1", 189 urls = ["https://github.com/bazelbuild/rules_fuzzing/releases/download/v0.5.1/rules_fuzzing-0.5.1.zip"], 190 patches = ["//third_party:rules_fuzzing.patch"], 191 patch_args = ["-p1"], 192) 193 194load("@rules_fuzzing//fuzzing:repositories.bzl", "rules_fuzzing_dependencies") 195 196rules_fuzzing_dependencies() 197 198load("@rules_fuzzing//fuzzing:init.bzl", "rules_fuzzing_init") 199 200rules_fuzzing_init() 201 202load("@fuzzing_py_deps//:requirements.bzl", fuzzing_py_deps_install_deps = "install_deps") 203 204fuzzing_py_deps_install_deps() 205 206http_archive( 207 name = "rules_rust", 208 integrity = "sha256-F8U7+AC5MvMtPKGdLLnorVM84cDXKfDRgwd7/dq3rUY=", 209 urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.46.0/rules_rust-v0.46.0.tar.gz"], 210) 211 212load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains") 213 214rules_rust_dependencies() 215 216rust_register_toolchains(edition = "2021") 217load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_repository") 218# to repin, invoke `CARGO_BAZEL_REPIN=1 bazel sync --only=crate_index` 219crates_repository( 220 name = "crate_index", 221 cargo_lockfile = "//:Cargo.lock", 222 lockfile = "//:Cargo.bazel.lock", 223 packages = { 224 "googletest": crate.spec( 225 git = "https://github.com/google/googletest-rust", 226 rev = "b407f3b5774defb8917d714bfb7af485e117d621", 227 ), 228 "paste": crate.spec( 229 version = ">=1", 230 ), 231 }, 232) 233 234load("@crate_index//:defs.bzl", "crate_repositories") 235crate_repositories() 236 237# For testing runtime against old gencode from a previous major version. 238http_archive( 239 name = "com_google_protobuf_v25.0", 240 strip_prefix = "protobuf-25.0", 241 url = "https://github.com/protocolbuffers/protobuf/releases/download/v25.0/protobuf-25.0.tar.gz", 242) 243 244# Needed as a dependency of @com_google_protobuf_v25.0 245load("@com_google_protobuf_v25.0//:protobuf_deps.bzl", protobuf_v25_deps="protobuf_deps") 246protobuf_v25_deps() 247 248# Needed for testing only 249load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 250http_archive( 251 name = "rules_testing", 252 sha256 = "02c62574631876a4e3b02a1820cb51167bb9cdcdea2381b2fa9d9b8b11c407c4", 253 strip_prefix = "rules_testing-0.6.0", 254 url = "https://github.com/bazelbuild/rules_testing/releases/download/v0.6.0/rules_testing-v0.6.0.tar.gz", 255) 256 257# For checking breaking changes to well-known types from the previous release version. 258load("//:protobuf_version.bzl", "PROTOBUF_PREVIOUS_RELEASE") 259 260http_archive( 261 name = "com_google_protobuf_previous_release", 262 strip_prefix = "protobuf-" + PROTOBUF_PREVIOUS_RELEASE, 263 url = "https://github.com/protocolbuffers/protobuf/releases/download/v{0}/protobuf-{0}.tar.gz".format(PROTOBUF_PREVIOUS_RELEASE), 264) 265 266http_archive( 267 name = "rules_buf", 268 integrity = "sha256-Hr64Q/CaYr0E3ptAjEOgdZd1yc+cBjp7OG1wzuf3DIs=", 269 strip_prefix = "rules_buf-0.3.0", 270 urls = [ 271 "https://github.com/bufbuild/rules_buf/archive/refs/tags/v0.3.0.zip", 272 ], 273) 274 275load("@rules_buf//buf:repositories.bzl", "rules_buf_dependencies", "rules_buf_toolchains") 276 277rules_buf_dependencies() 278 279rules_buf_toolchains(version = "v1.32.1") 280