rust-lang / rust-lang/cargo

`--artifact-dir` (nee `--out-dir`) Tracking Issue

Open
#6,790 54 comments 110 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-tracking-issue S-accepted Z-out-dir
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Note: this was renamed from --out-dir to --artifact-dir in #13809

Original issue: #4875
Implementation PR: #5203
Documentation: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#artifact-dir
Issues: https://github.com/rust-lang/cargo/labels/Z-out-dir

Summary
Adds --artifact-dir=PATH flag to cargo build to specify a directory to place final artifacts.

Tasks:

  • #5203
  • #13809
  • Remove --out-dir
  • Switch --artifact-dir to being the directory we uplift directly into with a fallback to the current location (done across all commands including cargo package)
  • Evaluate recording requested uplifts and performing them at the end
  • Evaluate only creating examples/ if needed (helps if we know a priori what is uplifted)
  • Detect conflicts in uplifts due to platform-tuple not being included
  • (design needed) explore templating of artifact-dir
  • Rework to better match https://github.com/rust-lang/cargo/issues/14125#issuecomment-2258708917

Unresolved questions

  • Multi-target builds (--target <one> --target <two>)
  • #7493
  • #6100 — concern about similarity with --target-dir, proliferation of flags
  • #6313 — concern about name collisions in workspaces or with examples
  • What exactly is the use case for this? In what scenario would it be used where you don't already have an outer build system or script that can copy the files into the correct location?
  • Confusion with rustc's --out-dir (#13809)
  • Discrepancy or confusion with build.rss OUT_DIR (depends on if build.rs is generating intermediate or final artifacts) (#13809)

Future possibilities

  • Deprecate --target-dir, hiding it from the CLI help

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the implementation PR #5203, the rename in #13809, and the unstable artifact-dir documentation. Then review the unchecked tasks and unresolved questions, especially the discussion in #14125. The issue does not define one bounded change or a clear completion test; scope would need to be agreed before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.