rust-lang / rust-lang/cargo

Handle source replacement separately for [dependencies] and [dev-dependencies]

Open
#7,679 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-build-dependencies A-source-replacement C-feature-request S-needs-design
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Describe the problem you are trying to solve

I understand that cargo has a feature to replace dependency source to self-hosted: https://doc.rust-lang.org/cargo/reference/source-replacement.html

However, it seems that I cannot do source replacement of source.crates-io only for [dependencies] but not for [build-dependencies]?

Describe the solution you'd like

Handle source replacement separately like this:

[source.dependencies.crates-io]
replace-with = "my-vendor-source-for-build-deps"

[source.dev-dependencies.crates-io]
replace-with = "my-vendor-source-for-dev-deps"

Notes

This issue has been discussed here: https://users.rust-lang.org/t/source-replacement-for-dependencies-only-but-not-for-build-dependencies/35411

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Cargo's source replacement documentation and the linked discussion about separating dependency categories. Determine how source replacement currently applies across dependency types; done means configuration can select different replacement sources for dependencies, build-dependencies, and dev-dependencies as requested.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.