From 9b56f7a04a12edfeb041724d061a06b5f594c4fd Mon Sep 17 00:00:00 2001 From: LongYinan Date: Sat, 15 Aug 2020 18:31:52 +0800 Subject: [PATCH] build: try fix docs-rs build --- napi/Cargo.toml | 3 +++ sys/Cargo.toml | 5 +---- sys/build.rs | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/napi/Cargo.toml b/napi/Cargo.toml index dfd453c1..fe52be24 100644 --- a/napi/Cargo.toml +++ b/napi/Cargo.toml @@ -32,3 +32,6 @@ optional = true [build-dependencies] napi-build = { version = "0.2", path = "../build" } + +[package.metadata.docs.rs] +rustc-args = ["--cfg", "docsrs"] diff --git a/sys/Cargo.toml b/sys/Cargo.toml index 8b4e8505..7a8bce3a 100644 --- a/sys/Cargo.toml +++ b/sys/Cargo.toml @@ -10,9 +10,6 @@ license = "MIT" keywords = ["NodeJS", "FFI", "NAPI", "n-api"] include = ["src/**/*", "Cargo.toml", "build.rs", ".node-headers/**/*"] -[features] -docs-rs = [] - [target.'cfg(windows)'.build-dependencies] flate2 = "1.0" reqwest = { version = "0.10", features = ["native-tls", "blocking"] } @@ -30,4 +27,4 @@ regex = "1.3" semver = "0.10" [package.metadata.docs.rs] -features = ["docs-rs"] +rustc-args = ["--cfg", "docsrs"] diff --git a/sys/build.rs b/sys/build.rs index 36123927..6533a30e 100644 --- a/sys/build.rs +++ b/sys/build.rs @@ -14,7 +14,7 @@ use std::env; use std::path::PathBuf; use std::process::Command; -#[cfg(not(any(target_os = "windows", feature = "docs-rs")))] +#[cfg(not(any(target_os = "windows", docsrs)))] const NODE_PRINT_EXEC_PATH: &'static str = "console.log(process.execPath)"; fn main() { @@ -55,7 +55,7 @@ fn main() { .expect("Unable to write napi bindings"); } -#[cfg(all(target_os = "windows", not(feature = "docs-rs")))] +#[cfg(all(target_os = "windows", not(docsrs)))] fn find_node_include_path(node_full_version: &str) -> PathBuf { let mut out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); out_path.push(format!("node-headers-{}.tar.gz", node_full_version)); @@ -81,14 +81,14 @@ fn find_node_include_path(node_full_version: &str) -> PathBuf { header_dist_path } -#[cfg(feature = "docs-rs")] +#[cfg(docsrs)] fn find_node_include_path(_node_full_version: &str) -> PathBuf { let mut current = env::current_dir().unwrap(); current.push(".node-headers"); current } -#[cfg(not(any(target_os = "windows", feature = "docs-rs")))] +#[cfg(not(any(target_os = "windows", docsrs)))] fn find_node_include_path(_node_full_version: &str) -> PathBuf { let node_exec_path = String::from_utf8( Command::new("node")