1#![allow(clippy::disallowed_methods, reason = "build scripts are exempt")]
2use std::process::Command;
3
4fn main() {
5 if std::env::var("ZED_UPDATE_EXPLANATION").is_ok() {
6 println!(r#"cargo:rustc-cfg=feature="no-bundled-uninstall""#);
7 }
8
9 if cfg!(target_os = "macos") {
10 println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.15.7");
11 }
12
13 // Populate git sha environment variable if git is available
14 println!("cargo:rerun-if-changed=../../.git/logs/HEAD");
15 if let Some(output) = Command::new("git")
16 .args(["rev-parse", "HEAD"])
17 .output()
18 .ok()
19 .filter(|output| output.status.success())
20 {
21 let git_sha = String::from_utf8_lossy(&output.stdout);
22 let git_sha = git_sha.trim();
23
24 println!("cargo:rustc-env=ZED_COMMIT_SHA={git_sha}");
25 }
26}