Skip to content

Commit

Permalink
try to use feature guard for docs.rs build
Browse files Browse the repository at this point in the history
  • Loading branch information
oberrich committed Apr 10, 2024
1 parent 39837ab commit 033fe39
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ build = "src/build.rs"
description = "Rust bindings to the System Informer's (formerly known as Process Hacker) `phnt` native Windows headers"
# exclude = ["deps"]

[features]
docsrs = []
default = []

[package.metadata.docs.rs]
features = ["docsrs"]
all-features = true
default-target = "x86_64-pc-windows-msvc"
targets = []
Expand Down
6 changes: 4 additions & 2 deletions src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ impl BindgenConfig {
}

fn main() {
println!("Skipping regeneration of bindings for docs.");
return;
if cfg!(feature = "docsrs") {
println!("Skipping regeneration of bindings for docs.");
return;
}

std::process::Command::new("git")
.args(["submodule", "update", "--remote", "--recursive"])
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
non_camel_case_types,
non_upper_case_globals
)]
#[cfg(not(feature="docsrs"))]
pub mod ffi {
#[cfg(not(feature="docsrs"))]
include!(concat!(env!("OUT_DIR"), "\\generated.rs"));

use std::arch::asm;
Expand Down

0 comments on commit 033fe39

Please sign in to comment.