rust-mobile / cargo-subcommand

Library for implementing cargo subcommands
6 stars 6 forks source link

Propagate `.cargo/config.toml` `[env]` settings to the process environment #16

Closed MarijnS95 closed 2 years ago

MarijnS95 commented 2 years ago

Leaving the caller to read and merge config environment values with the process environment is not only cumbersome as seen in rust-windowing/android-ndk-rs#233, but these values need to be propagated into the process environment anyway to be usable by any subprocess spawned by the caller (ie. cargo-apk spawning cargo rustc, which can internally spawn a bunch of compilers and linkers too).

Instead, do this automatically when the caller invokes Subcommand::new while still leaving the door open for crates to read the environment from the public subcommand.manifest.env member.

MarijnS95 commented 2 years ago

Thanks @dvc94ch, I'll go ahead and merge+publish this again as I really want these changes now, we can do another breaking followup release once your awesome clap changes are fleshed out and merged too :partying_face: