Skip to content

Conversation

epage
Copy link
Contributor

@epage epage commented Oct 10, 2025

What does this PR try to resolve?

This is meant to unblock efforts for allowing cargo scripts to use artifact names like deps without being sanitized or erroring. This is done by making the default target-dir exclude all build-dir content by putting the default cargo script target-dir under build-dir.

Cargo script target-dir precedence

before after
explicit target-dir explicit target-dir
"{cargo-cache-home}/target/{workspace-path-hash}" "{build-dir}/target"

Cargo script build-dir precedence

before after
explicit build-dir explicit build-dir
explicit target-dir explicit target-dir
"{cargo-cache-home}/target/{workspace-path-hash}" "{cargo-cache-home}/target/{workspace-path-hash}"

In doing this split, it highlighted the fact that we still had Cargo.lock for cargo scripts in target-dir despite being an intermediate build artifact, so this also moves that into build-dir. This does mean that if someone has a shared build-dir between their projects, their scripts will get a bit confusing. I plan to highlight that in the tracking issue / stabilization report.

How to test and review this PR?

Notes

Work left to do for artifact names

  • Stop creating examples/ when its not used
  • Move the conflict check from parse time to build time
  • Make the conflict check dependent on if target_dir == build_dir

@rustbot rustbot added A-workspaces Area: workspaces S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 10, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 10, 2025

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

epage added 4 commits October 10, 2025 15:17
Kind of confusing to have them defined in terms of each other but
- When we move the defualt `build-dir`, I expect we'll just delete the
  conditional and make the cargo script default `build-dir` the only
  default `build-dir`
- I plan to change the cargo script default `target-dir`
This avoids needing to be careful about cargo scripts conflicting with
"artifact names".
Granted, there will be more work to deal with the validation checks but
that comes later.
@epage epage changed the title fix(ws): Tweak cargo script build-dir / target-dir fix(script): Tweak cargo script build-dir / target-dir Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-workspaces Area: workspaces 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.

3 participants