|
@@ -2967,7 +2967,7 @@ impl BuildRequest {
|
|
|
//
|
|
|
if let Some(dxs) = package.dependencies.iter().find(|dep| dep.name == "dioxus") {
|
|
|
for f in dxs.features.iter() {
|
|
|
- if let Some(platform) = Platform::autodetect_from_cargo_feature(f) {
|
|
|
+ if let Some(platform) = Platform::from_dx_cargo_feature(f) {
|
|
|
platforms.push(platform);
|
|
|
}
|
|
|
}
|
|
@@ -2981,12 +2981,8 @@ impl BuildRequest {
|
|
|
// Check for any enabled features which enable a dioxus platform
|
|
|
for feature in enabled_features.iter() {
|
|
|
// If the user directly specified a platform we can just use that.
|
|
|
- if feature.starts_with("dioxus/") {
|
|
|
- let dx_feature = feature.trim_start_matches("dioxus/");
|
|
|
- let auto = Platform::autodetect_from_cargo_feature(dx_feature);
|
|
|
- if let Some(auto) = auto {
|
|
|
- platforms.push(auto);
|
|
|
- }
|
|
|
+ if let Some(auto) = Platform::from_user_cargo_feature(feature) {
|
|
|
+ platforms.push(auto);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -3001,31 +2997,23 @@ impl BuildRequest {
|
|
|
package: &krates::cm::Package,
|
|
|
enabled_features: &[String],
|
|
|
) -> Vec<String> {
|
|
|
- enabled_features
|
|
|
- .iter()
|
|
|
- .filter(|feature| {
|
|
|
- // Don't keep features that point to a platform via dioxus/blah
|
|
|
- if feature.starts_with("dioxus/") {
|
|
|
- let dx_feature = feature.trim_start_matches("dioxus/");
|
|
|
- if Platform::autodetect_from_cargo_feature(dx_feature).is_some() {
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
+ fn feature_enables_platform(package: &krates::cm::Package, feature: &str) -> bool {
|
|
|
+ if Platform::from_user_cargo_feature(feature).is_some() {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
- // Don't keep features that point to a platform via an internal feature
|
|
|
- if let Some(internal_feature) = package.features.get(*feature) {
|
|
|
- for feature in internal_feature {
|
|
|
- if feature.starts_with("dioxus/") {
|
|
|
- let dx_feature = feature.trim_start_matches("dioxus/");
|
|
|
- if Platform::autodetect_from_cargo_feature(dx_feature).is_some() {
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ if let Some(sub_features) = package.features.get(feature) {
|
|
|
+ sub_features
|
|
|
+ .iter()
|
|
|
+ .any(|sub_feature| feature_enables_platform(package, sub_feature))
|
|
|
+ } else {
|
|
|
+ false
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- true
|
|
|
- })
|
|
|
+ enabled_features
|
|
|
+ .iter()
|
|
|
+ .filter(|feature| !feature_enables_platform(package, feature))
|
|
|
.cloned()
|
|
|
.collect()
|
|
|
}
|