Skip to content

Latest commit

 

History

History
56 lines (46 loc) · 2.75 KB

File metadata and controls

56 lines (46 loc) · 2.75 KB

Third-party Rust Crates

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.

Adding a new vendored dependency

If a crate is not available in the vendor directory, it can to be added with the following steps:

  1. 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.
  2. Reference the crates you need in rustc_deps/Cargo.toml.
  3. Run scripts/fx update-rustc-third-party. This will download all crates listed in rustc_deps/Cargo.toml as well as their dependencies and place them in the vendor directory.
  4. git add the Cargo.toml, Cargo.lock and vendor directory.
  5. Merge the change into third_party/rust-crates.
  6. 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.

Adding a new mirror

  1. Request the addition of a mirror on fuchsia.googlesource.com;
  2. Add the mirror to the Jiri manifest for the Rust runtime;
  3. Add a patch section for the crate to the workspace;
  4. Run the update script.