From 53740ca75d167fab5c403a462e21ecd717b1dafa Mon Sep 17 00:00:00 2001 From: Euan Kemp Date: Fri, 17 Mar 2023 22:38:04 +0900 Subject: [PATCH 1/2] Don't download nodejs if NODE_BINARY is set Some build environments, such as nixpkgs, restrict network access and thus would prefer to not download anything at all. Setting PROTOC_BINARY and friends makes the build system not download stuff, and the same should be true for nodejs --- build/ninja_gen/src/node.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/build/ninja_gen/src/node.rs b/build/ninja_gen/src/node.rs index df05e149d..d08c7011e 100644 --- a/build/ninja_gen/src/node.rs +++ b/build/ninja_gen/src/node.rs @@ -105,16 +105,6 @@ pub fn setup_node( binary_exports: &[&'static str], mut data_exports: HashMap<&str, Vec>>, ) -> Result<()> { - download_and_extract( - build, - "node", - archive, - hashmap! { - "bin" => vec![if cfg!(windows) { "node.exe" } else { "bin/node" }], - "npm" => vec![if cfg!(windows) { "npm.cmd " } else { "bin/npm" }] - }, - )?; - let node_binary = match std::env::var("NODE_BINARY") { Ok(path) => { assert!( @@ -124,6 +114,15 @@ pub fn setup_node( path.into() } Err(_) => { + download_and_extract( + build, + "node", + archive, + hashmap! { + "bin" => vec![if cfg!(windows) { "node.exe" } else { "bin/node" }], + "npm" => vec![if cfg!(windows) { "npm.cmd " } else { "bin/npm" }] + }, + )?; inputs![":extract:node:bin"] } }; -- 2.39.2