Commit a32f77e
Pass wrapper.h to bindgen in-memory to avoid rebuild loop (#90)
Fixes #89.
Switch the build script from writing `$OUT_DIR/wrapper.h` and calling
`bindgen::Builder::header(path)` to calling
`bindgen::Builder::header_contents("wrapper.h", &content)`. The wrapper
exists only in memory, so there's no file for bindgen's `CargoCallbacks`
to register via `rerun-if-changed`, and cargo no longer treats the build
script as stale on every invocation.
The walk over `{includedir}/mlir-c/` is unchanged; the helper is renamed
from `generate_wrapper -> PathBuf` to `generate_wrapper_contents ->
String`. `PathBuf` import dropped.
### Verification
Two consecutive `cargo build`s on a downstream crate:
- **Before:** ~12s, full recompile, every time.
- **After:** ~12s on the first build, **0.07s** on the second.
Full downstream test suite (289 tests) passes.
*Assisted by Claude (Anthropic).*
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent c592848 commit a32f77e
1 file changed
Lines changed: 16 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
| |||
107 | 111 | | |
108 | 112 | | |
109 | 113 | | |
110 | | - | |
| 114 | + | |
111 | 115 | | |
112 | 116 | | |
113 | | - | |
| 117 | + | |
114 | 118 | | |
115 | 119 | | |
116 | 120 | | |
| |||
233 | 237 | | |
234 | 238 | | |
235 | 239 | | |
236 | | - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
237 | 248 | | |
238 | 249 | | |
239 | 250 | | |
| |||
243 | 254 | | |
244 | 255 | | |
245 | 256 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
| 257 | + | |
250 | 258 | | |
251 | 259 | | |
252 | 260 | | |
| |||
0 commit comments