1# Bazel Support 2 3## Basic Usage 4 5The `grpc/grpc` repository's primary build system is Bazel. Rules are provided 6for C++, Python, and Objective-C. While C++ supports other build systems such as 7CMake, these rules are actually generated from the Bazel definitions. 8 9Projects built with Bazel may use the `grpc/grpc` repo not only to add a 10dependency on the library itself, but also to generate protobuf, stub, and 11servicer code. To do so, one must invoke the `grpc_deps` and `grpc_extra_deps` 12repository rules in their `WORKSPACE` file: 13 14```starlark 15workspace(name = "example_workspace") 16 17load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 18 19http_archive( 20 name = "com_github_grpc_grpc", 21 strip_prefix = "grpc-1.45.0", 22 sha256 = "ec19657a677d49af59aa806ec299c070c882986c9fcc022b1c22c2a3caf01bcd", 23 urls = ["https://github.com/grpc/grpc/archive/refs/tags/v1.45.0.tar.gz"], 24) 25 26load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") 27 28grpc_deps() 29 30load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps") 31 32grpc_extra_deps() 33``` 34 35## Supported Versions 36 37gRPC supports building with the latest stable release of Bazel, 38as well as the previous major version release for at least 6 months 39after it transitions into maintenance mode. 40This is consistent with the supported build systems of 41[the Google Foundational C++ Support Policy](https://opensource.google/documentation/policies/cplusplus-support). 42However individual releases may have a broader 43compatibility range. The currently supported versions are captured by the 44following list: 45 46- [`7.1.0`](https://github.com/bazelbuild/bazel/releases/tag/7.1.0) 47- [`6.5.0`](https://github.com/bazelbuild/bazel/releases/tag/6.5.0) 48 49NOTE: gRPC doesn't support bzlmod yet.