|
2 | 2 |
|
3 | 3 | load("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure", "llvm_disable_optional_support_deps")
|
4 | 4 |
|
| 5 | +DEFAULT_REPO_MAPPING = { |
| 6 | + "@llvm_zlib": "@zlib", |
| 7 | +} |
| 8 | +LLVM_TARGETS = ["AArch64", "X86"] |
| 9 | + |
5 | 10 | # buildifier: disable=unnamed-macro
|
6 |
| -def rust_bindgen_transitive_dependencies(): |
7 |
| - """Declare transitive dependencies needed for bindgen.""" |
| 11 | +def rust_bindgen_transitive_dependencies(repo_mapping = DEFAULT_REPO_MAPPING): |
| 12 | + """Declare transitive dependencies needed for bindgen. |
| 13 | +
|
| 14 | + Args: |
| 15 | + repo_mapping: Mapping for renaming repositories created by this function. |
| 16 | + The repository names created by this function are undocumented and subject |
| 17 | + to change in the future. |
| 18 | + """ |
8 | 19 |
|
9 |
| - llvm_configure( |
10 |
| - name = "llvm-project", |
11 |
| - repo_mapping = {"@llvm_zlib": "@zlib"}, |
12 |
| - targets = [ |
13 |
| - "AArch64", |
14 |
| - "X86", |
15 |
| - ], |
16 |
| - ) |
| 20 | + # Bzlmod does not support the `repo_mapping` parameter *at all*, so we have |
| 21 | + # to only specify it when requested. |
| 22 | + if repo_mapping == None: |
| 23 | + llvm_configure( |
| 24 | + name = "llvm-project", |
| 25 | + targets = LLVM_TARGETS, |
| 26 | + ) |
| 27 | + else: |
| 28 | + llvm_repo_name = repo_mapping.get("llvm-project", default = "llvm-project") |
| 29 | + llvm_configure( |
| 30 | + name = llvm_repo_name, |
| 31 | + repo_mapping = repo_mapping, |
| 32 | + targets = LLVM_TARGETS, |
| 33 | + ) |
17 | 34 |
|
18 | 35 | # Disables optional dependencies for Support like zlib and terminfo. You may
|
19 | 36 | # instead want to configure them using the macros in the corresponding bzl
|
|
0 commit comments