rust-lang / rust-lang/rust-analyzer
How to track a generated file in build.rs
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
I generate a file in build.rs using OUT_DIR env and I want to see the result to be able to better understand what is generated.
The only way I found is to search in target dir the file, but if for example I add a dependencies, the build uuid change and so that not the same file anymore.
Would it be possible to track down the "most recent" version of the generate file ? I guess it could be hard.
The way I see it would be able to ask rust-analyzer the result of include!(concat!(env!("OUT_DIR"), "/foo.rs")); or somehow be able to config the IDE to open the file "$OUT_DIR/foo.rs into a window where OUT_DIR can change.
Maybe using print it in build.rs like:
println!("rust-analyzer:generated=foo.rs");
The could allow hint rust-analyzer such file have been generated.
If anyone know a nice solution I would be please to know it.
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 build.rs workflow and the OUT_DIR path used by include!(concat!(env!("OUT_DIR"), "/foo.rs")). The issue names no implementation file or test, so first determine how rust-analyzer discovers generated files and whether a stable way to track the most recent output can be defined; done means the generated file remains discoverable when build UUIDs change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100