Description
Feature Description
After skimming and searching the docs I cannot find out how to conditionally set or modify environment variables based on command line arguments.
- Example command, without arguments:
cargo make examples
- Example command, with argument:
cargo make examples verbose
When the 'verbose' argument is present on the command line, as above, the following environment variable needs to be set:
env = { "RUSTC_LOG" = "rustc_codegen_ssa::back::link=info" }
My use-case is that I need to see output from the linker sometimes (e.g. on CI server logs) and locally when builds fail, and also want a less-verbose build before pushing via git.
My tasks require specific 'target' setting, features, cargo args and cwd, and I use a cargo workspace.
Here's an excerpt from the Makefile.toml
[tasks.examples]
workspace = false
dependencies = [
"examples-nucleoh563zi",
]
[tasks.examples-nucleoh563zi]
workspace = false
dependencies = [
"examples-nucleoh563zi-hello-world",
]
[tasks.examples-nucleoh563zi-hello-world]
workspace = false
cwd = "crates/examples/nucleoh563zi"
command = "cargo"
env = { "RUSTC_LOG" = "rustc_codegen_ssa::back::link=info" }
args = ["build", "--bin=hello_world", "--target=thumbv7em-none-eabihf", "--release", "--features=mcu-stm32h563", "-vv"]
Did I miss something in the documentation? I read up on: tasks, conditions (they're for tasks), environment variables (creating ones, globals, etc), and arguments.