commit | 4610596caa3c2ddb2b5c627f63538075dd2abce2 | [log] [tgz] |
---|---|---|
author | Lukasz Anforowicz <lukasza@chromium.org> | Thu Apr 10 19:43:30 2025 |
committer | Chromium LUCI CQ <chromium-scoped@luci-project-accounts.iam.gserviceaccount.com> | Thu Apr 10 19:43:30 2025 |
tree | 9eb26085af96f5f171bf8b310334b8d2ed3230b7 | |
parent | acfa17f48aec4286bb0b891d1936abcd5f8b1c52 [diff] |
[gnrt] Don't filter out `default` feature (to match `cargo`). Manual testing shows that defining a `default` feature [1] in `Cargo.toml` like so: ``` $ cat Cargo.toml [package] name = "default-feature-ad-hoc-test" version = "0.1.0" edition = "2024" [dependencies] [features] default = ["blah"] blah = [] ``` Will end up passing `--cfg 'feature="default"'` to `rustc` so that the following code will print `"default"`: ``` $ cat src/main.rs #[cfg(feature = "default")] fn foo() { println!("default"); } #[cfg(not(feature = "default"))] fn foo() { println!("non-default"); } fn main() { foo(); } $ cargo run --verbose ... Running `.../bin/rustc ... --cfg 'feature="blah"' --cfg 'feature="default"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("blah", "default"))' ...` ... Running `target/debug/default-feature-ad-hoc-test` default ``` After this CL the `gnrt`-generated `BUILD.gn` files will mimic this aspect of `cargo` behavior. [1] https://doc.rust-lang.org/cargo/reference/features.html#the-default-feature Bug: 395924069 Change-Id: I5a35a586e16c5665e0fb7c7cc5d152d13ff2c37d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6428348 Commit-Queue: Ćukasz Anforowicz <lukasza@chromium.org> Reviewed-by: Collin Baker <collinbaker@chromium.org> Cr-Commit-Position: refs/heads/main@{#1445441}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone
! Instead, follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.