xref: /aosp_15_r20/external/bazelbuild-rules_python/examples/py_proto_library/WORKSPACE (revision 60517a1edbc8ecf509223e9af94a7adec7d736b8)
1# NB: short workspace name is required to workaround PATH length limitation, see
2# https://github.com/bazelbuild/bazel/issues/18683#issuecomment-1843857373
3workspace(name = "p")
4
5# The following local_path_override is only needed to run this example as part of our CI.
6local_repository(
7    name = "rules_python",
8    path = "../..",
9)
10
11# When not using this example in the rules_python git repo you would load the python
12# rules using http_archive(), as documented in the release notes.
13
14load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")
15
16# We install the rules_python dependencies using the function below.
17py_repositories()
18
19python_register_toolchains(
20    name = "python39",
21    python_version = "3.9",
22)
23
24# Then we need to setup dependencies in order to use py_proto_library
25load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
26
27http_archive(
28    name = "rules_proto",
29    sha256 = "904a8097fae42a690c8e08d805210e40cccb069f5f9a0f6727cf4faa7bed2c9c",
30    strip_prefix = "rules_proto-6.0.0-rc1",
31    url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.0-rc1/rules_proto-6.0.0-rc1.tar.gz",
32)
33
34load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
35
36rules_proto_dependencies()
37
38rules_proto_toolchains()
39
40http_archive(
41    name = "com_google_protobuf",
42    sha256 = "4fc5ff1b2c339fb86cd3a25f0b5311478ab081e65ad258c6789359cd84d421f8",
43    strip_prefix = "protobuf-26.1",
44    urls = ["https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz"],
45)
46
47load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
48
49protobuf_deps()
50