rust-mobile / cargo-subcommand

Library for implementing cargo subcommands
6 stars 6 forks source link

subcommand: Parse and propagate `[env]` vars at the earliest possible moment #18

Closed MarijnS95 closed 2 years ago

MarijnS95 commented 2 years ago

Strangely enough I added this call at a random place in Subcommand::new(), instead of considering that it was both:

  1. Breaking the logic for deducing target_dir in two separated blocks;
  2. Preventing the first block - which reads environment variables! - from seeing what was configured in .cargo/config.toml through [env].

Fix this by moving the call straight after identifying the root directory for the selected package.

MarijnS95 commented 2 years ago

@dvc94ch This reminds me, I have no idea how [env] vars are going to work with multiple-package selection. It seems the files are scanned from the package root instead of the workspace root, leading to multiple packages (within the same workspace of course) potentially having distinct environment variables...