commit | 3d5b3a9260cbf98746f0e77be5a8251e1fc77af0 | [log] [tgz] |
---|---|---|
author | Erik Gilling <konkers@google.com> | Thu Mar 23 17:31:05 2023 +0000 |
committer | Erik Gilling <konkers@google.com> | Thu Mar 23 17:31:05 2023 +0000 |
tree | adc9b8164fc454cc911422d2cc59af53c7af20f0 | |
parent | c39c1d1d4e4bdf2d8145beb8882af6f6e4e6dbbc [diff] |
Add support for `std` and `no_std` crates. Change-Id: I303fdbd0b8eaf70e9d2d8485901026bf3189976d Reviewed-on: https://pigweed-review.googlesource.com/c/third_party/rust_crates/+/134797 Reviewed-by: Ted Pudlik <tpudlik@google.com> Reviewed-by: Alexei Frolov <frolv@google.com>
This is a repository to vendor and provide build rules for the third party crates that Pigweed's rust code depends on. Currently only Bazel build rules are provided.
std
and no_std
This repository provides two separate sets of crates. One for std
environments and one for no_std
environments. The set that is used is determined by the //:std_enabled
constraint setting and defaults to std
. To use no_std
add @rust_crates//:no_std
to your platform definition.
The list of vendored crates is defined by the dependencies listed in //stub_crates/crates/Cargo.toml and //stub_crates/crates_std/Cargo.toml. The contents of the //crates
and //crates_std
directories are generated by the //:crates_vendor
and //:crates_vendor_std
targets. The aliases in the //:
namespace are generated by the create_aliases
tool. To update the vendored crates, build files, and aliases to match run:
bazel run //:crates_vendor -- --repin bazel run //:crates_vendor_std -- --repin (cd create_aliases ; \ cargo run -- --config ../aliases-config.toml ../stub_crates/*/Cargo.toml) \ > aliases.bzl
Licenses can be checked with cargo license -d
in the appropriate stub_crate.
= note: collect2: fatal error: cannot find 'ld' compilation terminated.
If you get the above error when running bazel run //:crates_vendor -- --repin
, ensure lld
is installed on your system. For instance:
sudo apt install lld