diff --git a/Cargo.lock b/Cargo.lock index 952ee6f..f4f0dd0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -297,7 +297,7 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "phnt" -version = "0.0.21" +version = "0.0.22" dependencies = [ "bindgen", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 624adce..5c2e3a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,20 +1,19 @@ [package] -name = "phnt" -version = "0.0.21" -license = "MIT" -authors = ["oberrich "] -repository = "https://github.com/oberrich/phnt-rs" -homepage = "https://github.com/oberrich/phnt-rs" -edition = "2021" -build = "src/build.rs" +name = "phnt" +version = "0.0.22" +license = "MIT" +authors = ["oberrich "] +repository = "https://github.com/oberrich/phnt-rs" +homepage = "https://github.com/oberrich/phnt-rs" +edition = "2021" +build = "src/build.rs" description = "Rust bindings to the System Informer's (formerly known as Process Hacker) `phnt` native Windows headers" # exclude = ["deps"] [features] -vendored = [] +regenerate = [] [package.metadata.docs.rs] -all-features = true default-target = "x86_64-pc-windows-msvc" targets = ["x86_64-pc-windows-msvc"] rustdoc-args = ["--cfg", "docsrs"] @@ -25,12 +24,12 @@ windows.features = ["Win32_Foundation"] windows-targets = "0.52.0" windows.version = "0.52.0" bindgen = "0.69.4" -regex = "1.10.3" -chrono = "0.4.37" +regex = "1.10.3" +chrono = "0.4.37" [dependencies] windows.features = ["Win32_Foundation"] windows-targets = "0.52.0" windows.version = "0.52.0" nt-string = "0.1.1" -cty = "0.2.2" \ No newline at end of file +cty = "0.2.2" diff --git a/src/build.rs b/src/build.rs index 8ad6a02..c2b1cba 100644 --- a/src/build.rs +++ b/src/build.rs @@ -23,7 +23,7 @@ #![cfg_attr(docsrs, feature(doc_cfg))] use std::collections::HashMap; use std::env; -#[cfg(all(not(feature = "vendored"), not(docsrs)))] +#[cfg(feature = "regenerate")] use std::path::PathBuf; use regex::Regex; @@ -133,14 +133,15 @@ impl BindgenConfig { } } -#[cfg_attr(docsrs, doc(cfg(any(feature = "vendored", docsrs))))] -#[cfg(any(feature = "vendored", docsrs))] +#[cfg_attr(docsrs, doc(cfg(not(feature = "regenerate"))))] +#[cfg(not(feature = "regenerate"))] fn main() { println!("Using vendored bindings, build script skipped."); } -#[cfg_attr(docsrs, doc(cfg(all(not(feature = "vendored"), not(docsrs)))))] -#[cfg(all(not(feature = "vendored"), not(docsrs)))] +// TODO(chore): Make vendored the default behavior and instead respect the "regenerate" +#[cfg_attr(docsrs, doc(cfg(feature = "regenerate")))] +#[cfg(feature = "regenerate")] fn main() { std::process::Command::new("git") .args(["submodule", "update", "--remote", "--recursive"]) diff --git a/src/lib.rs b/src/lib.rs index 0d3a876..0d97f30 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,13 +33,13 @@ /// Bindings for `phnt` (nightly) generated by `bindgen` pub mod ffi { // use vendored bindings - #[cfg_attr(docsrs, doc(cfg(any(feature = "vendored", docsrs))))] - #[cfg(any(feature = "vendored", docsrs))] + #[cfg_attr(docsrs, doc(cfg(not(feature = "regenerate"))))] + #[cfg(not(feature = "regenerate"))] include!("ffi/generated.rs"); // use re-generated bindings - #[cfg_attr(docsrs, doc(cfg(all(not(feature = "vendored"), not(docsrs)))))] - #[cfg(all(not(feature = "vendored"), not(docsrs)))] + #[cfg_attr(docsrs, doc(cfg(feature = "regenerate")))] + #[cfg(feature = "regenerate")] include!(concat!(env!("OUT_DIR"), "\\generated.rs")); }