From 4ceca08f4a7c36b24dc6790901c7b4ad9e7ec8c2 Mon Sep 17 00:00:00 2001 From: Gusto Date: Tue, 5 Dec 2023 17:07:55 +0200 Subject: [PATCH] Check for DOCS_RS env var to skip building waku go bin --- waku-sys/build.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/waku-sys/build.rs b/waku-sys/build.rs index 7693548..91c08f9 100644 --- a/waku-sys/build.rs +++ b/waku-sys/build.rs @@ -45,12 +45,6 @@ fn build_go_waku_lib(go_bin: &str, project_dir: &Path) { .arg(out_dir.join("libgowaku.a")) .arg("./library/c"); - // Setting `GOCACHE=/tmp/` for crates.io job that builds documentation - // when a crate is being published or updated. - if std::env::var("DOCS_RS").is_ok() { - cmd.env("GOCACHE", "/tmp/"); - } - cmd.status() .map_err(|e| println!("cargo:warning=go build failed due to: {e}")) .unwrap(); @@ -98,10 +92,13 @@ fn generate_bindgen_code() { #[cfg(not(doc))] fn main() { - let go_bin = get_go_bin(); - let project_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); - build_go_waku_lib(&go_bin, &project_dir); + // Skip building go waku binary if in Rust Docs environment. + if std::env::var("DOCS_RS").is_err() { + let go_bin = get_go_bin(); + build_go_waku_lib(&go_bin, &project_dir); + } + generate_bindgen_code(); }