Files
zed/crates/ui/build.rs
T
Albert Bogusz ddf752c410 Fix traffic light padding on macOS SDK 26+ builds (#58245)
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] ~~Unsafe blocks (if any) have justifying comments~~ (N/A)
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Corrects the value used for traffic light clearance/padding when
building with the macOS 26 SDK (or later). This was originally fixed in
#45351 but regressed in #48800 where `TRAFFIC_LIGHT_PADDING` was moved
to `ui/src/utils/constants.rs` but the local `build.rs` in `title_bar`
did not apply to the `ui` crate.

Release Notes:

- N/A
2026-06-02 19:59:51 +00:00

29 lines
771 B
Rust

#![allow(clippy::disallowed_methods, reason = "build scripts are exempt")]
fn main() {
println!("cargo::rustc-check-cfg=cfg(macos_sdk_26_or_later)");
#[cfg(target_os = "macos")]
{
use std::process::Command;
let output = Command::new("xcrun")
.args(["--sdk", "macosx", "--show-sdk-version"])
.output()
.unwrap();
let sdk_version = String::from_utf8(output.stdout).unwrap();
let major_version: Option<u32> = sdk_version
.trim()
.split('.')
.next()
.and_then(|v| v.parse().ok());
if let Some(major) = major_version
&& major >= 26
{
println!("cargo:rustc-cfg=macos_sdk_26_or_later");
}
}
}