0
Commit Graph

20 Commits

Author SHA1 Message Date
Lukasz Anforowicz
dad7e7f021 Make run_cargo_vet.py more idempotent.
This CL ensures that:

* Changes to `imports.lock` are ignored via `.gitignore` (and that when
  this file doesn't exist, then `cargo vet` still works because now we
  will create an empty file in this case).
* Changes to `config.toml` are reverted (when the only difference is in
  the comments) or warned about (for non-trivial changes)

This CL also opportunistically updates `docs/rust.md` instructions about
how to install `cargo-vet`:

* It adds a TODO to avoid the need to manually install `cargo-vet`
* It specifies an explicit version (0.9.1 seems to work well)
* It uses `--locked` to ensure `cargo-vet`'s dependencies cannot
  be tampered with (i.e. that we only need to trust the publishers
  of `cargo-vet` + `crates.io` + `rust-toolchain`)

Bug: 41494083
Change-Id: I7056537ecfb34197f5102df93dddbe152838a073
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5368308
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1271735}
2024-03-12 19:18:37 +00:00
Adrian Taylor
91eaa36325 Add some Rust println-related hints.
Based on feedback from an early user of our Rust toolchain that it wasn't
obvious what they were supposed to use.

Change-Id: Ie63edf873ac1fa799b4274cea68c14ff280d7d7c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5280678
Commit-Queue: danakj <danakj@chromium.org>
Auto-Submit: Adrian Taylor <adetaylor@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1258480}
2024-02-09 14:17:03 +00:00
Lukasz Anforowicz
2b5d0f8852 cargo vet: git add instructions should cover config.toml.
`gnrt vendor` regenerates `cargo vet`'s `config.toml` - this CL updates
the docs so that the `git add` step also covers the updated
`config.toml`.

Bug: 1521111
Change-Id: Ieaba1c908aa9943e255b2b7f235e2bd631a59041
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5238063
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1252887}
2024-01-26 22:04:37 +00:00
Lukasz Anforowicz
11c3487480 cargo vet: Helper script for invoking cargo vet ....
The script hardcodes a few necessary parameters which helps its users
to focus on the actual `cargo vet` commands they want to run.

Bug: 1521111
Change-Id: I5dea10b9b28d26144f89d12f9c7d130e0e92b7a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5235149
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1252167}
2024-01-25 17:15:46 +00:00
danakj
3dca9fb7c7 Remove docs and workarounds for missing cargo on Mac ARM machines
cargo is now part of the rust toolchain package for Mac ARM.

R=hans@chromium.org

Bug: 1515913
Change-Id: Ib304daa1398a1c4baf1f0845cfc1f9323e763a78
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5234510
Commit-Queue: Hans Wennborg <hans@chromium.org>
Auto-Submit: danakj <danakj@chromium.org>
Reviewed-by: Hans Wennborg <hans@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1251962}
2024-01-25 09:22:57 +00:00
danakj
b7de60704a Fix typo: audit.toml => audits.toml
Change-Id: I1b81b403e4c0b4a5341e1379c8a9e104a8d80ed4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5234652
Auto-Submit: danakj <danakj@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1251691}
2024-01-24 21:03:18 +00:00
Dominik Röttsches
a07a5536ff Update Rust package updating documentation
Change-Id: Ic0eea296bf7b2c31ae16dd1ed3bf5683f83fbd20
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5233622
Commit-Queue: Dominik Röttsches <drott@chromium.org>
Auto-Submit: Dominik Röttsches <drott@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1251572}
2024-01-24 19:16:23 +00:00
danakj
9535a9c0d7 Add run-cargo.py script which uses the cargo from the Chromium toolchain
This script sets up a PATH to the toolchain in
//third_party/rust-toolchain/bin for both cargo and rustc, and then
invokes `cargo` with the arguments given to it.

The run_gnrt.py script can now use this one to invoke cargo, and gnrt
no longer needs arguments for how to find rustc and cargo, since they
can be found through the path.

Bug: 1314345
Change-Id: Idda514d4c6933b9a6fe2e1783064fc5e8dfd9fd2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5174250
Reviewed-by: Collin Baker <collinbaker@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1246633}
2024-01-12 20:14:59 +00:00
danakj
aed1daf554 Make cargo vet work with our audits file and gnrt groups for crates
* Fix up the contents of audits.toml to be valid
* Add the imports.lock file which must be present
* Make the config.toml for vet become generated by `gnrt vendor`.
* Forward criteria from the google audit repo into ours so we can
  use them.

By generating the config.toml we can specify what policy we want
applied to each crate based on its group and shipped flags in the
gnrt_config.toml.

`cargo vet` does not yet pass, since we are missing audits for almost
all of our 3p crates at their given versions. Since we have reviewed
them, audits should be added next.

Bug: 1314345
Change-Id: I1b6ebdd26220f6d4cbadcf70bbc631d97db31091
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5170447
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1243478}
2024-01-05 17:44:32 +00:00
Nabil Wadih
a861644645 Update rust.md docs to remove patching script
apply_patches.sh no longer exists since this is now handled by
gnrt vendor. All of the necessary docs are already present so this
just removes the out of date part.

Change-Id: Id42e7afe7e043705a99bb3a9b89dab57a5d36add
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5116813
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Nabil Wadih <nwadih@google.com>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1237732}
2023-12-14 21:10:42 +00:00
danakj
f3d7f375cd Add instructions to point rust-analyzer to chrome's toolchain
Change-Id: I7c642a346863b3f22fb7c59e608e086ef285c0c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5100868
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1234590}
2023-12-07 18:17:12 +00:00
Lukasz Anforowicz
8452bd8d98 Various tweaks/improvements of Rust docs.
Bug: None
Change-Id: I8586ae59f703dfe2c158c9c75568ee75360ae294
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5068783
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1230295}
2023-11-28 23:31:55 +00:00
danakj
f509caa674 gnrt: Apply patches after downloading in gnrt vendor
For any new download, apply any patches in the patches/ directory for
that crate.

Also rebase the cxx patches which are not fixed when the vendor/
directory was introduced.

Bug: 1502569
Change-Id: Iff58026976678170adcc348cb0ba93230c6aaa3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5049667
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Adrian Taylor <adetaylor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1228469}
2023-11-23 15:29:43 +00:00
danakj
98bec160f5 Improve usage of gnrt and update docs
- Move the cargo/rustc path options out of the actions so that
  run_gnrt.py can always pass them and use the tools from the
  Chromium toolchain.
- Add a workaround to run_gnrt.py for Mac ARM since we don't ship cargo
  in the Chromium toolchain there yet.
- Plumb these tools around separately.
- Use `git add -f` to include some missed files in `vendor/`
- Add this to the instructions.
- Revamp instructions to use `gnrt add` and `gnrt update`.
- Talk about the gnrt_config.toml and groups in the instructions.
- A bit of cleanup refactoring.

Bug: 1502569, 1503710, 1503697
Change-Id: I0bf50b54e05b45babd1cef4c3e768a9db7a0c61d
Cq-Include-Trybots: luci.chromium.try:android-rust-arm32-rel,android-rust-arm64-dbg,android-rust-arm64-rel,linux-rust-x64-dbg,linux-rust-x64-rel,mac-rust-x64-dbg,win-rust-x64-dbg,win-rust-x64-rel
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5041754
Reviewed-by: Adrian Taylor <adetaylor@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1227381}
2023-11-21 14:55:02 +00:00
Adrian Taylor
c5fbb57e44 Including instructions for cargo development.
Change-Id: I7ed41ca73e7eb01f2d2bb8471afd8b76d95362ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5048836
Auto-Submit: Adrian Taylor <adetaylor@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1227372}
2023-11-21 14:25:42 +00:00
danakj
0ec93d1ef9 Introduce gnrt vendor and use it to download 3p dependencies.
This moves us from downloading with gnrt to doing versioning with
Cargo. gnrt uses Cargo's version decisions and then downloads all
crates that Cargo wants to depend on.

gnrt vendor updates README.chromium files with the updated versions,
licenses, and revision data.

This updates a bunch of crates that were out of date in ways that
Cargo did not like.

Bug: 1494118, 1475603, 1502569
Change-Id: Ie1c660c1c4459905b6bbd727a88cfa97ce8c8556
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5029701
Reviewed-by: Adrian Taylor <adetaylor@google.com>
Owners-Override: danakj <danakj@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1226139}
2023-11-17 16:12:23 +00:00
Adrian Taylor
138cb9f512 [rust] Add instructions to create patches.
Change-Id: I80fdb144f21af4e8cfffeff69c12a7553f3539e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5013670
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Adrian Taylor <adetaylor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1221768}
2023-11-08 18:41:54 +00:00
danakj
bb4d0c77c5 Update documentation about Rust
Move docs for working with 3p crates up to docs/rust.md. Document
that Rust is production ready and not experimental, and link to
what is approved by ATLs.

Bug: 1292073
Change-Id: Ic1d77d8f366bc7e6c1ff8b6f356097e0ec3309ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4929121
Reviewed-by: Adrian Taylor <adetaylor@google.com>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1209386}
2023-10-13 13:22:28 +00:00
Adrian Taylor
8a824c2359 [rust] Fetch Rust toolchain by default on Linux.
Our very first step towards enabling Rust code in Chromium canary is to
start to distribute the Rust toolchain. Initially, we'll do that only on
Linux.

Bug: 1292038
Change-Id: Id9a514fd0585c21a0fc0c0259b04ae9844d14f40
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4287201
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Adrian Taylor <adetaylor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1111454}
2023-03-01 07:04:14 +00:00
danakj
6e25f74ea8 Update the Rust documentation with state of the art perspective on Rust
Move to the top level docs, outside of the security subtree, for better
visibility.

R=adetaylor@chromium.org

Bug: 1292073
Change-Id: I7eab0bb83b3a269febc80b2e2f4c6d047157c299
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4051881
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Adrian Taylor <adetaylor@chromium.org>
Auto-Submit: danakj <danakj@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1078295}
2022-12-01 21:47:42 +00:00