Auto merge of #14701 - gterzian:patch-1, r=SimonSapin

update "working on a crate"

<!-- Please describe your changes on the following line: -->

Update of the "how to replace a dependency" part of "Hacking Servo".

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #14688 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because it only affects documentation.

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14701)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-12-24 07:51:43 -08:00 committed by GitHub
commit 3256af1ba0

View file

@ -108,20 +108,29 @@ This is how my projects are laid out:
```
~/my-projects/servo/
~/my-projects/cocoa-rs/
~/my-projects/glutin/
~/my-projects/mozjs/
```
Both folder are git repositories.
To make it so that servo uses `~/my-projects/mozjs/`, first ascertain which version of the crate Servo is using and whether it is a git dependency or one from crates.io.
Both information can be found using, in this example, `/mach cargo pkgid mozjs_sys`(`mozjs_sys` is the actual crate name, which doesn't necessarily match the repo folder name).
If the output is in the format `https://github.com/servo/mozjs#mozjs_sys:0.0.0`, you are dealing with a git dependency and you will have to edit the `~/my-projects/servo/Cargo.toml` file and add at the bottom:
``` toml
[replace]
"https://github.com/servo/mozjs#mozjs_sys:0.0.0" = { path = '../mozjs' }
```
These are all git repositories.
If the output is in the format `https://github.com/rust-lang/crates.io-index#mozjs_sys#0.0.0`, you are dealing with a crates.io dependency and you will have to edit the `~/my-projects/servo/Cargo.toml` in the following way:
To make it so that servo uses `~/my-projects/cocoa-rs/` and `~/my-projects/glutin/` , create a `~/my-projects/servo/.cargo/config` file:
``` shell
$ cat ~/my-projects/servo/.cargo/config
paths = ['../glutin', '../cocoa-rs']
``` toml
[replace]
"mozjs_sys:0.0.0" = { path = '../mozjs' }
```
This will tell any cargo project to not use the online version of the dependency, but your local clone.
Both will tell any cargo project to not use the online version of the dependency, but your local clone.
For more details about overriding dependencies, see [Cargo's documentation](http://doc.crates.io/specifying-dependencies.html#overriding-dependencies).