Open Bug 1469248 Opened 7 years ago Updated 3 years ago

Add a mach command to edit a vendored rust crate

Categories

(Firefox Build System :: General, enhancement)

3 Branch
enhancement

Tracking

(Not tracked)

People

(Reporter: ted, Unassigned)

References

Details

bug 1323557 ensured that editing a vendored Rust crate in third_party/rust worked (with the right incantation in .cargo/config). We should add a mach command to make this simple. bug 1323557 comment 30 explains what's necessary, which I will repeat here: 1) Ensure you have the latest version of cargo-vendor installed. 2) Add a section to .cargo/config like: ``` [patch.crates-io] zip = { path = "third_party/rust/zip" } ``` We generate .cargo/config from a source file, so the mach command should edit the source file in-place so that pushing the change to try works: https://dxr.mozilla.org/mozilla-central/source/.cargo/config.in 3) Run `mach vendor rust` to update Cargo.lock.
(In reply to Ted Mielczarek [:ted] [:ted.mielczarek] from comment #0) > 2) Add a section to .cargo/config like: > ``` > [patch.crates-io] > zip = { path = "third_party/rust/zip" } > ``` In bug 1323557 comment 30, I added this section to Cargo.toml (or rather added the patched crate's entry to the existing [patch.crates-io] section). I don't think Cargo observes [patch] sections in .cargo/config files (at least I don't see any documentation to that effect, nor was my attempt to add one successful). > 3) Run `mach vendor rust` to update Cargo.lock. This'll need to be `mach vendor rust --ignore-modified` (or you can commit the Cargo.toml change before vendoring, but then the first commit will leave the repo in an inconsistent state; better to commit the Cargo.toml and Cargo.lock changes together).
[patch.crates-io] can be added to top-level workspace Cargo.toml
Version: Version 3 → 3 Branch
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.