@@ -32,14 +32,20 @@ In addition to the Ruby prism dependencies, you shouldn't need anything else bes
3232
3333### Updating bindings
3434
35- ` build.rs ` (which gets called as part of running ` cargo build ` , ` cargo test ` , etc) is where we tell
36- ` bindgen ` which types, functions, etc. that we want it to generate for us. It's smart enough to know
37- to generate dependencies for items we specify in there (ex. ` pm_parser_t ` has fields of type
38- ` pm_token_t ` , but we don't need to tell ` bindgen ` about ` pm_token_t ` --it'll figure it out and
39- generate bindings for that type too).
40-
41- If you want to generate new bindings, update ` build.rs ` accordingly, then run ` cargo doc ` and check
42- the docs; that should tell you if ` bindgen ` generated all the things you need or not.
35+ The bindings are pregenerated and committed at ` src/bindings.rs ` , so building this crate does not
36+ require ` bindgen ` or libclang. ` build/main.rs ` is where we tell ` bindgen ` which types, functions,
37+ etc. that we want it to generate for us. It's smart enough to know to generate dependencies for
38+ items we specify in there (ex. ` pm_parser_t ` has fields of type ` pm_token_t ` , but we don't need to
39+ tell ` bindgen ` about ` pm_token_t ` --it'll figure it out and generate bindings for that type too).
40+
41+ If you want to generate new bindings, update the allowlist in ` build/main.rs ` accordingly, then run
42+ ` bundle exec rake cargo:bindings ` from the repository root (this requires libclang) to regenerate
43+ ` src/bindings.rs ` . CI regenerates the bindings and fails if the committed file is stale.
44+
45+ The ` buildtime_bindgen ` feature is the escape hatch that regenerates the bindings with ` bindgen ` at
46+ build time instead of using the pregenerated file. It's needed when ` RUBY_PRISM_CFLAGS ` contains
47+ defines that change the API surface, since the pregenerated bindings only reflect the default
48+ configuration.
4349
4450### Testing
4551
0 commit comments