Add support for config files#2917
Conversation
emilio
left a comment
There was a problem hiding this comment.
This is great (lacking tests but that should be doable?), that said, why making it cli-only? It seems it might be worth making it usable from the library as well. That way we can possibly even replace the bindgen-flags: stuff. But anyways even cli-only it seems worth doing.
yeah testing this shouldn't be that hard.
this would have the extra hiccup of having to move
That would be cool but at the same time we need some kind of test for the CLI args so we can check the flags actually work.
🎉 |
|
☔ The latest upstream changes (possibly #3365) made this pull request unmergeable. Please resolve the merge conflicts. |
This PR adds support for configuration files when using
bindgen-cli.The main motivation for this feature is that, with the growing number of options that bindgen has, it is hard to keep track on the options used in each invocation.
I decided to use TOML as it has become the de-facto configuration format in several Rust projects such as Cargo and Rustfmt.
To use this feature you can either pass the
--config-patharguments to bindgen with the path to the configuration file, or create abindgen.tomlfile in the current directory.If you want to use this feature but you don't want to transcribe your CLI arguments by hand, you can use the
--dump-configflag to dump the passed configuration into stdout.If you want to keep using bindgen the old way, you can pass the
--ignore-configflag. Which will ignore any configuration file, this includes both the--config-pathargument and the defaultbindgen.tomlfile.Fixes #1898 and #2508