Skip to content

Commit

Permalink
fix(cli): pass --no-default-features to runner instead of app, closes
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Oct 25, 2022
1 parent cb6ee77 commit a3a7021
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changes/cli-no-default-featurs-arg.md
@@ -0,0 +1,5 @@
---
"cli.rs": "patch"
---

Fix cli passing `--no-default-features` to the app instead of the runner (Cargo).
29 changes: 15 additions & 14 deletions tooling/cli/src/interface/rust.rs
Expand Up @@ -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")
Expand All @@ -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
Expand All @@ -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(
Expand Down

0 comments on commit a3a7021

Please sign in to comment.