DEP_FOO_KEY-like system that can work without "links"
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
Documentation: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#any-build-script-metadata
Implementation: https://github.com/rust-lang/cargo/pull/16436
Would it make sense to allow usage of DEP_<name>_<key environment variables in a build.rs for dependencies that do not link to native libraries?
Context: I would like to allow crates like this one to expose Cap'n Proto schema definitions, and in particular to allow Cap'n Proto's import mechanism to work across crate boundaries. (See https://github.com/dwrensha/capnpc-rust/issues/30.)
For example, say I write a my_app crate that depends on the sandstorm crate, and I want my_app to have some capnp schemas that import from the sandstorm schemas. For this to work, the my_app build.rs needs to know where to find the source code of the sandstorm schemas. One way to accomplish that would be for the sandstorm crate's build.rs to write its current working directory to a DEP_SANDSTORM_IMPORT environment variable, through the mechanism described here. However, that only works if the sandstorm crate has a "links" field in its Cargo.toml. Since the sandstorm crate does not actually need to link to a native library, adding such a field feels superfluous and possibly prone to mysterious bugs.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the unstable Cargo build-script metadata documentation and the implementation discussed in Cargo PR 16436. Trace how DEP__ is currently exposed only through the links mechanism; done would mean dependencies without native-library links can expose the metadata needed for cross-crate Cap’n Proto imports.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100