Skip to content

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

Closed
@ojeda

Description

@ojeda

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-featureCategory: feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions