Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifying a set of cfgs for given crates (cfg groups) #17815

Closed
ojeda opened this issue Aug 7, 2024 · 0 comments · Fixed by #17857
Closed

Specifying a set of cfgs for given crates (cfg groups) #17815

ojeda opened this issue Aug 7, 2024 · 0 comments · Fixed by #17857
Labels
C-feature Category: feature request

Comments

@ojeda
Copy link

ojeda commented Aug 7, 2024

The Linux kernel has ~20k (yes, kilo!) configuration options, and we pass them via --cfgs. This means that, in our rust-project.json file, we have to put (a subset of) all of them, repeated per crate.

Currently we only have a small number of crates, but our configuration file can already reach 150k lines, ~7.5 MiB with just 6 crates (plus core etc. that do not need the cfgs). As Rust in the kernel grows, and as we start splitting our kernel crate in smaller ones, it can get out of control soon: we may have 10 now, but we can eventually end up with 1000s if Rust is a success. Thus the file size may explode, and I imagine performance and memory usage may not be great either, depending on how it is implemented.

From a quick look at the documentation, it does not seem like one can define a set of "global" cfgs to apply to "all" crates. Ideally, one would be able to define "groups" and then apply those groups to some crates before their individual set of cfgs.

So, for instance, in our case, we would just define a group like "kernel": ["CONFIG_...=...", ...], with essentially all the cfgs, and then in each kernel crate that needs them we would have a key like: "cfg_groups": ["kernel"],, rather than repeating every time all the cfgs in the existing "cfg" key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: feature request
Projects
None yet
1 participant