Files
shorebird-updater/library/build.rs
T
Eric Seidel e4b182d75d chore: fix 30 of the 54 warnings from clippy pedantic. (#81)
I just ran `cargo clippy -- -W clippy::pedantic` and fixed things.

These are more invasive that the default set and the remaining
warnings are mostly about our (abysmal) public docs missing
Error and Panic sections to explain errors and panicks.
2023-09-08 17:51:07 +00:00

26 lines
815 B
Rust

extern crate cbindgen;
use std::env;
// See:
// <https://github.com/eqrion/cbindgen/blob/master/docs.md#buildrs>
// <https://doc.rust-lang.org/cargo/reference/build-scripts.html>
// <https://doc.rust-lang.org/cargo/reference/build-script-examples.html>
fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
// Should this write to the out dir (target) instead?
let result = cbindgen::generate(crate_dir);
match result {
Ok(contents) => {
contents.write_to_file("include/updater.h");
}
Err(e) => {
println!("cargo:warning=Error generating bindings: {e}");
// If we were to exit 1 here we would stop local rust
// analysis from working. So we just print the error
// and continue.
}
}
}