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