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

Allow config-relative paths in command aliases #15083

Open
Nemo157 opened this issue Jan 20, 2025 · 0 comments
Open

Allow config-relative paths in command aliases #15083

Nemo157 opened this issue Jan 20, 2025 · 0 comments
Labels
A-aliases Area: command aliases C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage.

Comments

@Nemo157
Copy link
Member

Nemo157 commented Jan 20, 2025

Problem

When using nested-workspaces it's not possible to use the normal xtask pattern as the xtask package does not exist in the inner workspace. It would be useful if in the alias we can explicitly specify that it uses this workspace's manifest even if the current-directory is within another one.

Proposed Solution

One idea I had was something similar to how [env] lets you specify relative = true, if that were supported for components of the alias then it could be something like:

[alias]
xtask = [
  "run",
  "--manifest-path",
  { path = "Cargo.toml", relative = true },
  "--package=xtask",
  "--bin=xtask",
  "--"
]

Notes

This is sort of related to #9123, but that cli flag doesn't work for this usecase for two reasons:

  1. It will still be using the inner-workspace to detect what the "root" is, not the outer one that defines the .cargo/config.toml.
  2. It will change the current-working-directory for the command being run, the xtask still wants to be able to resolve its own arguments relative to where it's being run from, we just want to change the path used to find the binary to run.
@Nemo157 Nemo157 added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Jan 20, 2025
@epage epage added the A-aliases Area: command aliases label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-aliases Area: command aliases C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants