cargo icon indicating copy to clipboard operation
cargo copied to clipboard

Rename --out-dir to --artifact-dir

Open valadaptive opened this issue 1 year ago • 4 comments

Progress towards unblocking #6790. Renames the experimental --out-dir argument to --artifact-dir, both to reflect that it's where the final build artifacts will be copied to, and to avoid confusion with the OUT_DIR environment variable which serves an entirely different purpose.

Existing users of the --out-dir argument and out-dir config.toml key will be redirected to --artifact-dir via a warning message.

Rationale

A lot of people seem to be confused by the naming of the --out-dir argument, and are misled into thinking it serves the same purpose as the OUT_DIR environment variable:

However, it doesn't seem that OUT_DIR environment variable is set to the value of --out-dir when build.rs is executed.

I understand that the worry is that there could be confusion between --out-dir for cargo and the environment variable OUT_DIR for build.rs, but doesn't it mean exactly the same in both cases?

--out-dir: Things will be built into $PWD/target as normal, but copies some of the artifacts into the directory specified by out-dir (not a profile specific subdirectory). Unstable flag, added in March 2018. cargo build --out-dir #5203 Ability to specify output artifact name #4875. Mimicks the behavior of OUT_DIR.

I recently had a couple of people express an interest in --out-dir being stabilized and from my initial digging it seems like what they may actually want is to switch to OUT_DIR, which is already stable.

valadaptive avatar Apr 26 '24 20:04 valadaptive

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @epage (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

rustbot avatar Apr 26 '24 20:04 rustbot

Grim news. Perhaps both flags must be briefly supported to deal with the bootstrap problem.

workingjubilee avatar Apr 27 '24 01:04 workingjubilee

Never mind; it seems I was a bit zealous in replacing --out-dir and accidentally search-and-replaced it in some rustc invocations. Might still need to do some fixups but we're looking a lot better now.

valadaptive avatar May 04 '24 02:05 valadaptive

This should be ready for review now. Not sure if this needs to go through any sort of design process since it's renaming a nightly-only API. There does seem to be some consensus in #6790 that --artifact-dir is a better name.

valadaptive avatar May 04 '24 06:05 valadaptive

@epage Just wanted to make sure this hasn't fallen off your radar--it's ready for review now.

valadaptive avatar May 21 '24 03:05 valadaptive

I have about a month backlog of github notifications that I still need to respond to.

epage avatar May 21 '24 20:05 epage

Could you update the commits for how you'd want them presented for review and merging?

epage avatar Jun 06 '24 20:06 epage

I've updated the flag-checking code and squashed most of the commits.

Should the deprecation messages provide some sort of warning that the old options will eventually be removed, or are they fine currently?

valadaptive avatar Jun 07 '24 07:06 valadaptive

Thanks!

@bors r+

epage avatar Jun 07 '24 16:06 epage

:pushpin: Commit 0aac3039563276f68e4c80c6962916b11ebb28b8 has been approved by epage

It is now in the queue for this repository.

bors avatar Jun 07 '24 16:06 bors

:hourglass: Testing commit 0aac3039563276f68e4c80c6962916b11ebb28b8 with merge 4189f504aebc4b50612b6d6a071674cec9c7a2ff...

bors avatar Jun 07 '24 16:06 bors

:sunny: Test successful - checks-actions Approved by: epage Pushing 4189f504aebc4b50612b6d6a071674cec9c7a2ff to master...

bors avatar Jun 07 '24 16:06 bors