fix: don't set macos deployment target in dev (#14083)

* fix: don't set macos deployment target in dev.

* doc comment

* Update .changes/skip-deployment-target-in-dev.md

* Apply suggestions from code review

---------

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
This commit is contained in:
Fabian-Lars
2025-08-27 22:07:07 +02:00
committed by GitHub
parent 9a35a616f5
commit c23bec62d6
8 changed files with 23 additions and 6 deletions

View File

@@ -0,0 +1,7 @@
---
tauri-build: patch:enhance
tauri-cli: patch:enhance
'@tauri-apps/cli': patch:enhance
---
Tauri now ignores `macOS.minimumSystemVersion` in `tauri dev` to prevent forced rebuilds of macOS specific dependencies when using something like `rust-analyzer` at the same time as `tauri dev`.

View File

@@ -573,8 +573,10 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
}
}
if let Some(version) = &config.bundle.macos.minimum_system_version {
println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET={version}");
if !is_dev() {
if let Some(version) = &config.bundle.macos.minimum_system_version {
println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET={version}");
}
}
}

View File

@@ -3483,7 +3483,7 @@
]
},
"minimumSystemVersion": {
"description": "A version string indicating the minimum macOS X version that the bundled application supports. Defaults to `10.13`.\n\n Setting it to `null` completely removes the `LSMinimumSystemVersion` field on the bundle's `Info.plist`\n and the `MACOSX_DEPLOYMENT_TARGET` environment variable.\n\n An empty string is considered an invalid value so the default value is used.",
"description": "A version string indicating the minimum macOS X version that the bundled application supports. Defaults to `10.13`.\n\n Setting it to `null` completely removes the `LSMinimumSystemVersion` field on the bundle's `Info.plist`\n and the `MACOSX_DEPLOYMENT_TARGET` environment variable.\n\n Ignored in `tauri dev`.\n\n An empty string is considered an invalid value so the default value is used.",
"default": "10.13",
"type": [
"string",

View File

@@ -104,6 +104,10 @@ pub fn command(mut options: Options, verbosity: u8) -> Result<()> {
let config_guard = config.lock().unwrap();
let config_ = config_guard.as_ref().unwrap();
if let Some(minimum_system_version) = &config_.bundle.macos.minimum_system_version {
std::env::set_var("MACOSX_DEPLOYMENT_TARGET", minimum_system_version);
}
let app_settings = interface.app_settings();
let interface_options = options.clone().into();

View File

@@ -136,6 +136,10 @@ pub fn command(options: Options, verbosity: u8) -> crate::Result<()> {
let config_guard = config.lock().unwrap();
let config_ = config_guard.as_ref().unwrap();
if let Some(minimum_system_version) = &config_.bundle.macos.minimum_system_version {
std::env::set_var("MACOSX_DEPLOYMENT_TARGET", minimum_system_version);
}
let app_settings = interface.app_settings();
let interface_options = options.clone().into();

View File

@@ -157,8 +157,6 @@ impl Interface for Rust {
"IPHONEOS_DEPLOYMENT_TARGET",
&config.bundle.ios.minimum_system_version,
);
} else if let Some(minimum_system_version) = &config.bundle.macos.minimum_system_version {
std::env::set_var("MACOSX_DEPLOYMENT_TARGET", minimum_system_version);
}
let app_settings = RustAppSettings::new(config, manifest, target)?;

View File

@@ -3483,7 +3483,7 @@
]
},
"minimumSystemVersion": {
"description": "A version string indicating the minimum macOS X version that the bundled application supports. Defaults to `10.13`.\n\n Setting it to `null` completely removes the `LSMinimumSystemVersion` field on the bundle's `Info.plist`\n and the `MACOSX_DEPLOYMENT_TARGET` environment variable.\n\n An empty string is considered an invalid value so the default value is used.",
"description": "A version string indicating the minimum macOS X version that the bundled application supports. Defaults to `10.13`.\n\n Setting it to `null` completely removes the `LSMinimumSystemVersion` field on the bundle's `Info.plist`\n and the `MACOSX_DEPLOYMENT_TARGET` environment variable.\n\n Ignored in `tauri dev`.\n\n An empty string is considered an invalid value so the default value is used.",
"default": "10.13",
"type": [
"string",

View File

@@ -640,6 +640,8 @@ pub struct MacConfig {
/// Setting it to `null` completely removes the `LSMinimumSystemVersion` field on the bundle's `Info.plist`
/// and the `MACOSX_DEPLOYMENT_TARGET` environment variable.
///
/// Ignored in `tauri dev`.
///
/// An empty string is considered an invalid value so the default value is used.
#[serde(
deserialize_with = "de_macos_minimum_system_version",