Skip to content

Allow config-relative paths in command aliases #15083

Open
@Nemo157

Description

@Nemo157

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-aliasesArea: command aliasesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions