0
Files
src/tools/crates
Lukasz Anforowicz c96c7754a8 [gnrt] Teach platforms.rs about target_family = ... conditions.
Overview of the problem fixed by this CL
----------------------------------------

`cargo tree` under `tools/crates/gnrt/sample_package` shows that
`time` crate depends on `libc` and `num_threads`:

    ```
    sample_package v0.1.0 (...)
    ├── bar v0.1.0 (...)
    ├── foo v0.1.0 (...)
    │   ├── ...
    │   └── time v0.3.14
    │       ├── libc v0.2.133
    │       └── num_threads v0.1.6
    ...
    ```

Despite the above, before this CL, `libc` and `num_threads` would be
incorrectly missing when running the
`collect_dependencies_on_sample_output` test.  AFAICT this is because
the dependency is conditional, and before this CL `platforms.rs` didn't
understand `target_family = ...` kind of conditions.

This CL is kind of temporary
----------------------------

Changes in this CL are somewhat temporary, because `platforms.rs` will
disappear soon in https://crrev.com/c/6300716.  This CL is done
separately to make it easier to review and justify unit test changes in
this smaller, separate CL.

Testing
-------

This CL has been tested by:

* Running `tools/crates/run_gnrt.py gen` and verifying it doesn't make
  any changes under `//third_party/rust`.  (Only `gen` depends on
  `fn collect_dependencies` from `deps.rs`.)
* Same for `tools/rust/gnrt_stdlib.py`
* Running `cargo test` under `tools/crates/gnrt`

Bug: 395924069
Change-Id: I11d80cb85197b3cf0f6f6bc39921939d1d666a34
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6300655
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1425233}
2025-02-26 10:03:27 -08:00
..

This directory contains tools for importing third-party Rust crates and constructing BUILD.gn files from them.

See //docs/rust.md for information about Rust in Chromium.

See //tools/rust/README.md for information on rolling and building the Rust toolchain.