CLI: only push a dioxus/* fallback feature if the crate being compiled (#5143)
depends on the `dioxus` crate.
This commit is contained in:
1 parent
99240ef000
commit
c68a47b2d3
1 file changed
+18
-13
@@ -826,12 +826,12 @@ impl BuildRequest {
|
|||||||
|
|
||||||
// Add any features required to turn on the client
|
// Add any features required to turn on the client
|
||||||
if let Some(renderer) = renderer {
|
if let Some(renderer) = renderer {
|
||||||
features.push(Self::feature_for_platform_and_renderer(
|
if let Some(feature) =
|
||||||
main_package,
|
Self::feature_for_platform_and_renderer(main_package, &triple, renderer)
|
||||||
&triple,
|
{
|
||||||
renderer,
|
features.push(feature);
|
||||||
));
|
features.dedup();
|
||||||
features.dedup();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the profile of the build if it's not already set
|
// Set the profile of the build if it's not already set
|
||||||
@@ -3571,7 +3571,7 @@ impl BuildRequest {
|
|||||||
package: &krates::cm::Package,
|
package: &krates::cm::Package,
|
||||||
triple: &Triple,
|
triple: &Triple,
|
||||||
renderer: Renderer,
|
renderer: Renderer,
|
||||||
) -> String {
|
) -> Option<String> {
|
||||||
// Try to find the feature that activates the dioxus feature for the given platform
|
// Try to find the feature that activates the dioxus feature for the given platform
|
||||||
let dioxus_feature = renderer.feature_name(triple);
|
let dioxus_feature = renderer.feature_name(triple);
|
||||||
|
|
||||||
@@ -3611,12 +3611,17 @@ impl BuildRequest {
|
|||||||
None
|
None
|
||||||
});
|
});
|
||||||
|
|
||||||
res.unwrap_or_else(|| {
|
res.or_else(|| {
|
||||||
let fallback = format!("dioxus/{dioxus_feature}");
|
let depends_on_dioxus = package.dependencies.iter().any(|dep| dep.name == "dioxus");
|
||||||
tracing::debug!(
|
if depends_on_dioxus {
|
||||||
"Could not find explicit feature for renderer {renderer}, passing `fallback` instead"
|
let fallback = format!("dioxus/{dioxus_feature}");
|
||||||
);
|
tracing::debug!(
|
||||||
fallback
|
"Could not find explicit feature for renderer {renderer}, passing `fallback` instead"
|
||||||
|
);
|
||||||
|
Some(fallback)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user