Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename --out-dir to --artifact-dir #13809

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

valadaptive
Copy link

@valadaptive valadaptive commented Apr 26, 2024

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.

@rustbot
Copy link
Collaborator

rustbot commented Apr 26, 2024

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 rustbot added A-build-execution Area: anything dealing with executing the compiler A-cli Area: Command-line interface, option parsing, etc. A-cli-help Area: built-in command-line help A-documenting-cargo-itself Area: Cargo's documentation A-layout Area: target output directory layout, naming, and organization A-semver Area: semver specifications, version matching, etc. Command-build Command-fix S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 26, 2024
@valadaptive valadaptive mentioned this pull request Apr 26, 2024
5 tasks
@workingjubilee
Copy link

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

Currently this breaks the build because some Cargo scripts seem to use a
version of cargo that somehow recognizes out-dir instead of artifact-dir
@valadaptive
Copy link
Author

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.

@rustbot rustbot added the A-configuration Area: cargo config files and env vars label May 4, 2024
@valadaptive valadaptive force-pushed the artifact-dir branch 4 times, most recently from 2de8e22 to 549b724 Compare May 4, 2024 04:32
@valadaptive valadaptive marked this pull request as ready for review May 4, 2024 06:18
@valadaptive
Copy link
Author

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 valadaptive changed the title WIP: rename out-dir to artifact-dir Rename --out-dir to --artifact-dir May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build-execution Area: anything dealing with executing the compiler A-cli Area: Command-line interface, option parsing, etc. A-cli-help Area: built-in command-line help A-configuration Area: cargo config files and env vars A-documenting-cargo-itself Area: Cargo's documentation A-layout Area: target output directory layout, naming, and organization A-semver Area: semver specifications, version matching, etc. Command-build Command-fix S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants