1
- use std:: env;
2
1
use std:: ffi:: OsString ;
3
- use std:: str:: FromStr ;
4
2
use std:: path:: PathBuf ;
5
3
use std:: process:: Command ;
6
4
@@ -11,7 +9,7 @@ use rustc_target::spec::Target;
11
9
pub ( super ) use rustc_target:: spec:: apple:: OSVersion ;
12
10
use tracing:: debug;
13
11
14
- use crate :: errors:: { AppleDeploymentTarget , XcrunError , XcrunSdkPathWarning } ;
12
+ use crate :: errors:: { XcrunError , XcrunSdkPathWarning } ;
15
13
use crate :: fluent_generated as fluent;
16
14
17
15
#[ cfg( test) ]
@@ -134,54 +132,6 @@ pub(super) fn add_data_and_relocation(
134
132
Ok ( ( ) )
135
133
}
136
134
137
- /// Name of the environment variable used to fetch the deployment target on the given OS.
138
- pub fn deployment_target_env_var ( os : & str ) -> & ' static str {
139
- match os {
140
- "macos" => "MACOSX_DEPLOYMENT_TARGET" ,
141
- "ios" => "IPHONEOS_DEPLOYMENT_TARGET" ,
142
- "watchos" => "WATCHOS_DEPLOYMENT_TARGET" ,
143
- "tvos" => "TVOS_DEPLOYMENT_TARGET" ,
144
- "visionos" => "XROS_DEPLOYMENT_TARGET" ,
145
- _ => unreachable ! ( "tried to get deployment target env var for non-Apple platform" ) ,
146
- }
147
- }
148
-
149
- /// Get the deployment target based on the standard environment variables, or fall back to the
150
- /// minimum version supported by `rustc`.
151
- pub fn deployment_target ( sess : & Session ) -> OSVersion {
152
- let min = OSVersion :: minimum_deployment_target ( & sess. target ) ;
153
- let env_var = deployment_target_env_var ( & sess. target . os ) ;
154
-
155
- if let Ok ( deployment_target) = env:: var ( env_var) {
156
- match OSVersion :: from_str ( & deployment_target) {
157
- Ok ( version) => {
158
- let os_min = OSVersion :: os_minimum_deployment_target ( & sess. target . os ) ;
159
- // It is common that the deployment target is set a bit too low, for example on
160
- // macOS Aarch64 to also target older x86_64. So we only want to warn when variable
161
- // is lower than the minimum OS supported by rustc, not when the variable is lower
162
- // than the minimum for a specific target.
163
- if version < os_min {
164
- sess. dcx ( ) . emit_warn ( AppleDeploymentTarget :: TooLow {
165
- env_var,
166
- version : version. fmt_pretty ( ) . to_string ( ) ,
167
- os_min : os_min. fmt_pretty ( ) . to_string ( ) ,
168
- } ) ;
169
- }
170
-
171
- // Raise the deployment target to the minimum supported.
172
- version. max ( min)
173
- }
174
- Err ( error) => {
175
- sess. dcx ( ) . emit_err ( AppleDeploymentTarget :: Invalid { env_var, error } ) ;
176
- min
177
- }
178
- }
179
- } else {
180
- // If no deployment target variable is set, default to the minimum found above.
181
- min
182
- }
183
- }
184
-
185
135
pub ( super ) fn add_version_to_llvm_target (
186
136
llvm_target : & str ,
187
137
deployment_target : OSVersion ,
0 commit comments