Skip to content

Support --target-dir#627

Open
ychampion wants to merge 1 commit into
sourcefrog:mainfrom
ychampion:support-target-dir
Open

Support --target-dir#627
ychampion wants to merge 1 commit into
sourcefrog:mainfrom
ychampion:support-target-dir

Conversation

@ychampion

Copy link
Copy Markdown

Fixes #407.

Problem

cargo mutants --target-dir ... is rejected even though Cargo accepts the same option. The existing --cargo-arg=--target-dir=... workaround works, but prevents cargo mutants from being used as a drop-in replacement in scripts that already set a target directory.

Change

  • accept --target-dir <DIRECTORY> as a build option
  • pass it unchanged to every Cargo check, build, and test command
  • document the option and its existing configuration-file equivalent

Validation

  • red-before argv regression reproduced the Clap unexpected argument '--target-dir' error
  • cargo test target_dir_is_passed_to_all_cargo_commands -- --nocapture
  • env -u NO_COLOR TERM=xterm-256color cargo test --all-features -- --skip build_dir::test::fail_to_overwrite --skip build_dir::test::fail_to_overwrite_dir_permission_denied - 287 unit and 138 integration tests passed; the skipped permission tests cannot exercise EACCES while running as root
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check
  • end-to-end --check smoke against small_well_tested verified the requested directory in the baseline Cargo command and completed all four mutants

Expose the documented cargo-arg workaround as a first-class CLI option and preserve Cargo's path semantics across check, build, and test phases.

Constraint: Keep the configuration schema unchanged; additional_cargo_args remains the config-file equivalent.

Rejected: Add a target_dir config key | issue sourcefrog#407 requests drop-in CLI compatibility and the existing passthrough already covers configuration.

Confidence: high

Scope-risk: narrow

Tested: all-feature unit/integration suite excluding two root-invalid permission tests; all-target/all-feature Clippy; cargo fmt; end-to-end target-directory smoke

Not-tested: build_dir permission-denial tests cannot exercise EACCES while running as root.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support --target-dir

1 participant