Look for strip settings in inherited profiles and global configs (#4645)

* Look for strip settings in inherited profiles and global configs

* fix clippy

* use cargo home env var if it exists

* fix cargo home config path

* small stylistic changes

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
Evan AlmloffandJonathan Kelley authored and GitHub committed 2025-10-03 21:11:05 -07:00
1 parent c39cae6c57
commit c56bac04f4
4 files changed
+187 -5

No files matched your search

+22 -2
View File
@@ -326,6 +326,7 @@ use crate::{
};
use anyhow::{bail, Context};
use cargo_metadata::diagnostic::Diagnostic;
use cargo_toml::{Profile, Profiles, StripSetting};
use depinfo::RustcDepInfo;
use dioxus_cli_config::{format_base_path_meta_element, PRODUCT_NAME_ENV};
use dioxus_cli_config::{APP_TITLE_ENV, ASSET_ROOT_ENV};
@@ -3509,9 +3510,28 @@ impl BuildRequest {
(_, false) => ("dev", cargo_toml.profile.dev.as_ref()),
};
let Some(profile) = profile else { return };
let Some(profile) = profile else {
return;
};
let Some(strip) = profile.strip.as_ref() else {
// Get the strip setting from the profile or the profile it inherits from
fn get_strip(profile: &Profile, profiles: &Profiles) -> Option<StripSetting> {
profile.strip.clone().or_else(|| {
// If we can't find the strip setting, check if we inherit from another profile
profile.inherits.as_ref().and_then(|inherits| {
let profile = match inherits.as_str() {
"dev" => profiles.dev.as_ref(),
"release" => profiles.release.as_ref(),
"test" => profiles.test.as_ref(),
"bench" => profiles.bench.as_ref(),
other => profiles.custom.get(other),
};
profile.and_then(|p| get_strip(p, profiles))
})
})
}
let Some(strip) = get_strip(profile, &cargo_toml.profile) else {
// If the profile doesn't have a strip option, we don't need to warn
return;
};