|
9 | 9 | # instructions at https://github.com/reboot-dev/pyprotoc-plugin. |
10 | 10 | ######################################################################## |
11 | 11 |
|
| 12 | +load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") |
12 | 13 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") |
13 | | -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") |
14 | 14 |
|
15 | | -def repos(): |
16 | | - """Adds repositories/archives needed by pyprotoc-plugin.""" |
| 15 | +def repos(external = True, repo_mapping = {}): |
| 16 | + """Adds repositories/archives needed by pyprotoc-plugin |
17 | 17 |
|
18 | | - maybe( |
19 | | - http_archive, |
| 18 | + Args: |
| 19 | + external: whether or not we're invoking this function as though |
| 20 | + though we're an external dependency |
| 21 | + repo_mapping: passed through to all other functions that expect/use |
| 22 | + repo_mapping, e.g., 'git_repository' |
| 23 | + """ |
| 24 | + http_archive( |
20 | 25 | name = "rules_python", |
21 | | - sha256 = "4f7e2aa1eb9aa722d96498f5ef514f426c1f55161c3c9ae628c857a7128ceb07", |
22 | | - strip_prefix = "rules_python-1.0.0", |
23 | | - url = "https://github.com/bazelbuild/rules_python/releases/download/1.0.0/rules_python-1.0.0.tar.gz", |
| 26 | + sha256 = "9acc0944c94adb23fba1c9988b48768b1bacc6583b52a2586895c5b7491e2e31", |
| 27 | + strip_prefix = "rules_python-0.27.0", |
| 28 | + url = "https://github.com/bazelbuild/rules_python/releases/download/0.27.0/rules_python-0.27.0.tar.gz", |
| 29 | + repo_mapping = repo_mapping, |
24 | 30 | ) |
25 | 31 |
|
26 | | - maybe( |
27 | | - http_archive, |
28 | | - name = "com_google_protobuf", |
29 | | - sha256 = "955ef3235be41120db4d367be81efe6891c9544b3a71194d80c3055865b26e09", |
30 | | - strip_prefix = "protobuf-29.5", |
31 | | - urls = [ |
32 | | - "https://github.com/protocolbuffers/protobuf/archive/v29.5.tar.gz", |
33 | | - ], |
34 | | - ) |
| 32 | + if "com_google_protobuf" not in native.existing_rules(): |
| 33 | + git_repository( |
| 34 | + name = "com_google_protobuf", |
| 35 | + remote = "https://github.com/protocolbuffers/protobuf", |
| 36 | + # Release v3.19.4. |
| 37 | + # TODO(codingcanuck): Update to a newer release after |
| 38 | + # https://github.com/protocolbuffers/protobuf/issues/9688 is fixed. |
| 39 | + commit = "22d0e265de7d2b3d2e9a00d071313502e7d4cccf", |
| 40 | + shallow_since = "1643340956 -0800", |
| 41 | + repo_mapping = repo_mapping, |
| 42 | + ) |
| 43 | + |
| 44 | + if external and "com_github_reboot_dev_pyprotoc_plugin" not in native.existing_rules(): |
| 45 | + git_repository( |
| 46 | + name = "com_github_reboot_dev_pyprotoc_plugin", |
| 47 | + remote = "https://github.com/reboot-dev/pyprotoc-plugin", |
| 48 | + commit = "9f7a281670f03b77140c4437ac2a56b86f978af6", |
| 49 | + shallow_since = "1649038239 +0000", |
| 50 | + repo_mapping = repo_mapping, |
| 51 | + ) |
0 commit comments