Third-party crates depended on by rustc_binary
and rustc_library
targets
are stored in //third-party/rust-crates/rustc_deps/vendor
.
This set of crates is based on the dependencies listed in
//third_party/rust-crates/rustc_deps/Cargo.toml
,
and is updated by running fx update-rustc-third-party
, which will update
the precise versions of the crates used in the Cargo.lock
file and download
any necessary crates into the vendor
dir.
If a crate is not available in the vendor directory, it can to be added with the following steps:
- If you have not yet received OSRB approval for the library, you will need to do so by following the instructions under the "Process for 3rd Party Hosted Code" section in this document. If you are not a Google employee, you will need to ask a Google employee to do this part for you.
- Reference the crates you need in
rustc_deps/Cargo.toml
. - Run
scripts/fx update-rustc-third-party
. This will download all crates listed inrustc_deps/Cargo.toml
as well as their dependencies and place them in thevendor
directory. git add
theCargo.toml
,Cargo.lock
andvendor
directory.- Merge the change into third_party/rust-crates.
- Update the git revision of
third_party/rust-crates
in integration/fuchsia/garnet/third_party:
<project name="rust-crates"
path="third_party/rust-crates"
remote="https://fuchsia.googlesource.com/third_party/rust-crates"
revision="<YOUR_NEW_REVISION_HERE>"
gerrithost="https://fuchsia-review.googlesource.com"/>
Once all that is done, navigate to third_party/rust-crates
locally,
run git checkout <YOUR_NEW_REVISION_HERE>
, build Garnet to ensure that your
change is working, then open a CL.
Linking to a native library is not currently supported.
- Request the addition of a mirror on fuchsia.googlesource.com;
- Add the mirror to the Jiri manifest for the Rust runtime;
- Add a patch section for the crate to the workspace;
- Run the update script.