refactor: Move env parsing of deployment target to rustc_session

This commit is contained in:
Mads Marquart 2025-02-11 11:02:36 +01:00
parent d74ce25b65
commit 7e4379c4eb
11 changed files with 74 additions and 75 deletions

View file

@ -317,3 +317,15 @@ impl OSVersion {
Self { major, minor, patch }
}
}
/// Name of the environment variable used to fetch the deployment target on the given OS.
pub fn deployment_target_env_var(os: &str) -> &'static str {
match os {
"macos" => "MACOSX_DEPLOYMENT_TARGET",
"ios" => "IPHONEOS_DEPLOYMENT_TARGET",
"watchos" => "WATCHOS_DEPLOYMENT_TARGET",
"tvos" => "TVOS_DEPLOYMENT_TARGET",
"visionos" => "XROS_DEPLOYMENT_TARGET",
_ => unreachable!("tried to get deployment target env var for non-Apple platform"),
}
}