Check for DOCS_RS env var to skip building waku go bin

This commit is contained in:
Gusto 2023-12-05 17:07:55 +02:00
parent 027fba91cb
commit 4ceca08f4a
No known key found for this signature in database
1 changed files with 6 additions and 9 deletions

View File

@ -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();
}