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

Cargo should support configuration in non-hidden files. #8244

Open
jrvanwhy opened this issue May 15, 2020 · 4 comments
Open

Cargo should support configuration in non-hidden files. #8244

jrvanwhy opened this issue May 15, 2020 · 4 comments
Labels
A-configuration Area: cargo config files and env vars C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-team-input Status: Needs input from team on whether/how to proceed.

Comments

@jrvanwhy
Copy link

Describe the problem you are trying to solve

Currently, cargo searches for configuration files by looking for a directory named .cargo, which is a hidden directory. This means that a typical ls invocation does not reveal the existence of a config file. This makes it difficult to debug problems caused by cargo config files, particularly for contributors who are new to a project.

Describe the solution you'd like

I would like Cargo to search for a config file in a non-hidden location, such as cargo/config. This way projects that want to use Cargo configs and make that config visible can do so.

Alternative idea in case searching in a new location is considered a breaking change: We could add a field to Cargo.toml pointing to the Cargo config to use when invoked from within a particular crate or workspace.

Notes

The Tock project uses Makefiles to pass flags to rustc and the linker rather than using a cargo config because they do not want to have any configs in hidden files.

@jrvanwhy jrvanwhy added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label May 15, 2020
@jrvanwhy
Copy link
Author

Adding @ppannuto from the Tock project.

@ppannuto
Copy link

It's not just ls, the majority of tools (find, grep, etc) will ignore hidden files.

Putting critical build configuration in files that standard tools will not find makes discovery very challenging for new and even experienced users. Particularly in embedded systems contexts, non-trivial compiler customization is often necessary, and it's important that how targets are configured be easily visible.

From our experiences with TinyOS, using any hidden files to drive configuration is a non-starter for Tock.

@ehuss ehuss added the A-configuration Area: cargo config files and env vars label May 24, 2020
@malaire
Copy link

malaire commented Jan 12, 2021

I agree. The Cargo.toml is not hidden and so requiring .cargo/config to be hidden is not consistent.

@epage
Copy link
Contributor

epage commented Nov 4, 2023

Generally, when I see projects do this, they use a _ prefix instead to sort these "semi-hidden" files and directories separately from the rest.

: We could add a field to Cargo.toml pointing to the Cargo config to use when invoked from within a particular crate or workspace.

Config files are environment configuation, distinct from project configuration, see #12738

@epage epage added the S-needs-team-input Status: Needs input from team on whether/how to proceed. label Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-configuration Area: cargo config files and env vars C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-team-input Status: Needs input from team on whether/how to proceed.
Projects
None yet
Development

No branches or pull requests

5 participants