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

Way for dependencies to read configuration from dependents/access dependent's manifest directory #9977

Closed
kepexx opened this issue Oct 17, 2021 · 2 comments
Labels
A-build-scripts Area: build.rs scripts C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-propose-close Status: A team member has nominated this for closing, pending further input from the team

Comments

@kepexx
Copy link

kepexx commented Oct 17, 2021

Problem

I was working on a project and I needed a way for my crate to be able to be customized based on a configuration file from the dependent, via build.rs. The configuration would be to add extra fields to structs, as they will be present in actual builds due to a custom build system (which also reads from those config files and adds the fields). This is for the sake of IDEs properly error reporting.

Proposed Solution

The build script is given an environment variable such as CARGO_DEPENDENT, which contains the dependent crates' manifests' paths separated by commas.

Notes

If this isn't practical, is there any other way to achieve the specific use case I'm trying to do here?

@kepexx kepexx added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Oct 17, 2021
@ehuss ehuss added the A-build-scripts Area: build.rs scripts label Oct 19, 2021
@epage epage added the S-triage Status: This issue is waiting on initial triage. label Nov 20, 2024
@epage
Copy link
Contributor

epage commented Dec 6, 2024

As this inverts the relationship of dependency / dependent, I propose we close this.

For controlling the behavior of dependencies, we have

  • --cfg
  • [features]

We also have a proposal for global, mutually exclusive features.

@epage epage added S-propose-close Status: A team member has nominated this for closing, pending further input from the team and removed S-triage Status: This issue is waiting on initial triage. labels Dec 6, 2024
@weihanglo
Copy link
Member

Second. See also #13484.

@weihanglo weihanglo closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build-scripts Area: build.rs scripts C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-propose-close Status: A team member has nominated this for closing, pending further input from the team
Projects
None yet
Development

No branches or pull requests

4 participants