xref: /aosp_15_r20/external/bazelbuild-rules_rust/bindgen/3rdparty/patches/README.md (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1*d4726bddSHONG Yifan# Patches
2*d4726bddSHONG Yifan
3*d4726bddSHONG YifanAll patches pair with the versions of the referenced repositories defined in `@rules_rust//bindgen:repositories.bzl`.
4*d4726bddSHONG Yifan
5*d4726bddSHONG Yifan## [llvm-project.cxx17](./llvm-project.cxx17.patch)
6*d4726bddSHONG Yifan
7*d4726bddSHONG YifanThe llvm-project requires a compiler that builds with at least C++14 but there's no configuration
8*d4726bddSHONG Yifanfor this on the targets defined in the repo. This patch plumbs through flags for setting the C++
9*d4726bddSHONG Yifanversion on targets to avoid any need for bazel configuration flags. If this patch causes issues
10*d4726bddSHONG Yifanfor users with their current toolchain or toolchain definitions then simply defining the `llvm-raw`
11*d4726bddSHONG Yifanrepository before loading `rust_bindgen_dependencies` should avoid this.
12*d4726bddSHONG Yifan
13*d4726bddSHONG Yifan## [llvm-project.incompatible_disallow_empty_glob](./llvm-project.incompatible_disallow_empty_glob.patch)
14*d4726bddSHONG Yifan
15*d4726bddSHONG YifanUses of `glob` are updated to have `allow_empty = True` added so the llvm-project repo is compatible
16*d4726bddSHONG Yifanwith consumers building with [--incompatible_disallow_empty_glob](https://bazel.build/reference/command-line-reference#flag--incompatible_disallow_empty_glob).
17*d4726bddSHONG Yifan
18*d4726bddSHONG YifanMost of this patch is generated using the following regex and replace patterns. There are a handful
19*d4726bddSHONG Yifanof additional modifications for more extravagant globs.
20*d4726bddSHONG Yifan
21*d4726bddSHONG Yifan| regex | replace |
22*d4726bddSHONG Yifan| --- | --- |
23*d4726bddSHONG Yifan| `glob\(([\[\w\d_\-\*\/\.\],=\n\s"]+)\) \+` | `glob($1, allow_empty = True) +` |
24*d4726bddSHONG Yifan| `glob\(([\[\w\d_\-\*\/\.\],=\n\s"]+)\),` | `glob($1, allow_empty = True),` |
25*d4726bddSHONG Yifan| `(,[\s\n]+), ` | `$1` |
26