Files
shorebird-updater/library/build.rs
T
Eric Seidel 9d4ce55c2b refactor: Prepare to have more than one event type (#77)
Refactored our PatchInstallEvent to be just PatchEvent
and allow us to have more than one event type.

I moved it into its own events.rs file and added privacy
warnings to both this and the network code (eventually
we may move all this into a separate privacy.rs file).

I also fixed our build.rs file to not panic when our build
is otherwise broken. For whatever reason that seems to
cause the rust-analyzer to stop and not show any future
warnings (thus it's hard to fix things).

I moved away from having a "new" method for PatchEvent
with a series of Strings (which could be confused in order)
and instead am now using just the normal default struct
construction which effectively has named args.

Since EventType is now an enum, it's easy to use the
right enum not have to call PatchInstallEvent::new to
get the right magic string for "identifier".

Also added a bit more documentation to c_api.rs
2023-09-07 12:31:32 -07:00

26 lines
811 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.
}
}
}