Debian Codegraph @

doc/bazel_support.md

raw
1 # Bazel Support
2
3 ## Basic Usage
4
5 The `grpc/grpc` repository's primary build system is Bazel. Rules are provided
6 for C++, Python, and Objective-C. While C++ supports other build systems such as
7 CMake, these rules are actually generated from the Bazel definitions.
8
9 Projects built with Bazel may use the `grpc/grpc` repo not only to add a
10 dependency on the library itself, but also to generate protobuf, stub, and
11 servicer code. To do so, one must invoke the `grpc_deps` and `grpc_extra_deps`
12 repository rules in their `WORKSPACE` file:
13
14 ```starlark
15 workspace(name = "example_workspace")
16
17 load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
18
19 http_archive(
20 name = "com_github_grpc_grpc",
21 strip_prefix = "grpc-1.45.0",
22 sha256 = "ec19657a677d49af59aa806ec299c070c882986c9fcc022b1c22c2a3caf01bcd"k
23 urls = ["https://github.com/grpc/grpc/archive/refs/tags/v1.45.0.tar.gz"],
24 )
25
26 load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
27
28 grpc_deps()
29
30 load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
31
32 grpc_extra_deps()
33 ```
34
35 ## Supported Versions
36
37 In general, gRPC supports building with the latest patch release of the two most
38 recent LTS versions of Bazel. However individual releases may have a broader
39 compatibility range. The currently supported versions are captured by the
40 following list:
41
42 - [`5.3.1`](https://github.com/bazelbuild/bazel/releases/tag/5.3.1)
43 - [`4.2.2`](https://github.com/bazelbuild/bazel/releases/tag/4.2.2)