build: try fix docs-rs build
This commit is contained in:
parent
f8711f33d9
commit
9b56f7a04a
3 changed files with 8 additions and 8 deletions
|
@ -32,3 +32,6 @@ optional = true
|
|||
|
||||
[build-dependencies]
|
||||
napi-build = { version = "0.2", path = "../build" }
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue