fix(cli): pass --no-default-features to runner instead of app, closes #5415 (#5474)

This commit is contained in:
Amr Bashir
2022-10-25 15:26:30 +02:00
committed by GitHub
parent cb6ee77e69
commit a3a70218f3
2 changed files with 20 additions and 14 deletions

View File

@@ -0,0 +1,5 @@
---
"cli.rs": "patch"
---
Fix cli passing `--no-default-features` to the app instead of the runner (Cargo).

View File

@@ -285,7 +285,20 @@ impl Rust {
mut options: Options,
on_exit: F,
) -> crate::Result<DevChild> {
if !options.args.contains(&"--no-default-features".into()) {
let mut args = Vec::new();
let mut run_args = Vec::new();
let mut reached_run_args = false;
for arg in options.args.clone() {
if reached_run_args {
run_args.push(arg);
} else if arg == "--" {
reached_run_args = true;
} else {
args.push(arg);
}
}
if !args.contains(&"--no-default-features".into()) {
let manifest_features = self.app_settings.manifest.features();
let enable_features: Vec<String> = manifest_features
.get("default")
@@ -300,7 +313,7 @@ impl Rust {
}
})
.collect();
options.args.push("--no-default-features".into());
args.push("--no-default-features".into());
if !enable_features.is_empty() {
options
.features
@@ -309,18 +322,6 @@ impl Rust {
}
}
let mut args = Vec::new();
let mut run_args = Vec::new();
let mut reached_run_args = false;
for arg in options.args.clone() {
if reached_run_args {
run_args.push(arg);
} else if arg == "--" {
reached_run_args = true;
} else {
args.push(arg);
}
}
options.args = args;
desktop::run_dev(