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 vendoring of path dependencies #10134

Open
stevenroose opened this issue Nov 29, 2021 · 5 comments
Open

Allow vendoring of path dependencies #10134

stevenroose opened this issue Nov 29, 2021 · 5 comments
Labels
C-bug Category: bug Command-vendor S-triage Status: This issue is waiting on initial triage.

Comments

@stevenroose
Copy link

stevenroose commented Nov 29, 2021

Problem

I have a path dependency (crate-name = { path = "/some/local/dir" }) in my Cargo.toml and when I run cargo vendor, it doesn't show up in the vendor directory, so when I export the current directory, that crate is unaccounted for.

Steps

  1. create a crate dep1 in ~/tmp/dep1
  2. create a crate project1 in ~/tmp/project1
  3. add dep1 = { path = "../dep1" } to ~/tmp/project1/Cargo.toml's dependency section
  4. go into ~/tmp/project1
  5. run cargo vendor

Possible Solution(s)

Don't make a special exception for path dependencies when vendoring.

Notes

No response

Version

cargo 1.49.0 (d00d64df9 2020-12-05)
@stevenroose stevenroose added the C-bug Category: bug label Nov 29, 2021
@weihanglo
Copy link
Member

Similar issue: #9172

Seems that cargo-vendor skips path dependency at this moment.

// No need to vendor path crates since they're already in the
// repository
if pkg.source_id().is_path() {
continue;
}

@ehuss
Copy link
Contributor

ehuss commented Jan 4, 2022

Can you share some more details about your use case?

Cargo does not support source replacement of path dependencies, so just including path dependencies in the vendor directory won't help.

@hbina
Copy link
Contributor

hbina commented Oct 2, 2023

I am working on a project where I need to make a lot of little changes to many crates that I use. I also would like to test them out in various environemnt (Windows, Linux, MacOS). So it is desirable to be able to simply checkin all these changes.

I thought I was able to do this:

  1. Work on crate A which depends on crate B.
  2. Notice I need to make a change on crate B.
  3. Create a local copy of B.
  4. Vendor crate B, check in the code.
  5. Checkout the commit in other environments to test them out.

I could have cloned each crates individually, checkout the specific branch, and coordinate all this.

I am not sure why cargo is making that choice on my behalf?

@epage epage changed the title Vendoring broken for path dependencies Allow vendoring of path dependencies Oct 2, 2023
@epage epage added the S-triage Status: This issue is waiting on initial triage. label Oct 2, 2023
@stevenroose
Copy link
Author

I proposed #12858 to solve this issue.

@weihanglo
Copy link
Member

Hi. @hbina I don't quite get the case you share. Do you have a sample project or Cargo.toml to demo?

As I understand it, you want to vendor every change of you path dependencies, and share it across different machines to test it. If your project is under git control, is it possible to just create a git branch containing those change?

@stevenroose could you share the use case or workflow of why you want path dependencies also are exported s vendored source?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug Command-vendor S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants