paritytech / substrate

Substrate: The platform for blockchain innovators
Apache License 2.0
8.39k stars 2.65k forks source link

Avoid including bin/node/cli/src/cli.rs in build.rs #14806

Open zdave-parity opened 1 year ago

zdave-parity commented 1 year ago

bin/node/cli/src/cli.rs looks like a regular module. But if you for example try to reference a sibling module from it, the compiler will confusingly tell you that this sibling module can't be found. This is because as well as being built as a regular module, cli.rs is also included in build.rs. AFAICT this is to generate shell completions at build time. It seems like this could be achieved without using include!. The simplest option might be to have a separate crate just for generating shell completions. This could pull in cli.rs via a crate dependency.