Add NO_ZIG_INSTALLED check to Netlify build

This commit is contained in:
Richard Feldman 2022-02-28 20:28:01 -05:00
parent 1c116d71b3
commit 02ecb63b48
No known key found for this signature in database
GPG key ID: 7E4127D1E4241798

View file

@ -1,3 +1,4 @@
use std::env;
use std::ffi::OsStr;
use std::path::Path;
use std::process::Command;
@ -11,6 +12,15 @@ fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=src/{}.c", PLATFORM_FILENAME);
// When we build on Netlify, zig is not installed (but also not used,
// since all we're doing is generating docs), so we can skip the steps
// that require having zig installed.
if env::var_os("NO_ZIG_INSTALLED").is_some() {
// We still need to do the other things before this point, because
// setting the env vars is needed for other parts of the build.
return;
}
std::fs::create_dir_all("./data").unwrap();
// Build a pre-linked binary with platform, builtins and all their libc dependencies