From 1858ac37f1e2fd23d195d9e536cdb20185410014 Mon Sep 17 00:00:00 2001 From: Gabriel Vogel Date: Wed, 21 Jun 2023 22:46:03 +0200 Subject: [PATCH] Make examples in main workspace visible to run-wasm xtask (#3880) --- xtask/src/main.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/xtask/src/main.rs b/xtask/src/main.rs index ae00c4e2d..2a79a4e24 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -2,6 +2,7 @@ use std::process::ExitCode; use anyhow::Context; use cli::{Args, Subcommand}; +use pico_args::Arguments; mod cli; @@ -26,7 +27,15 @@ fn main() -> ExitCode { fn run(args: Args) -> anyhow::Result<()> { let Args { subcommand } = args; match subcommand { - Subcommand::RunWasm { args } => { + Subcommand::RunWasm { mut args } => { + // Use top-level Cargo.toml instead of xtask/Cargo.toml by default + let manifest_path = args.value_from_str("--manifest-path") + .unwrap_or_else(|_| "../Cargo.toml".to_string()); + let mut arg_vec = args.finish(); + arg_vec.push("--manifest-path".into()); + arg_vec.push(manifest_path.into()); + let args = Arguments::from_vec(arg_vec); + cargo_run_wasm::run_wasm_with_css_and_args( "body { margin: 0px; }", cargo_run_wasm::Args::from_args(args)