I have a "build.rs" program which generates a file in OUT_DIR, the official place for generated files. The generated file has to be included in the source tree and compiled into the project. So I have a file in the project which contains only
Works fine. The question is, what tells Cargo when to recompile that file? If the included file changes, will it be recompiled? Or do I need to do something to make that happen? How does Cargo know?
Ah, understood. That happens automatically. When rustc compiles a crate, it can produce a depinfo file -- a list of files which were used to compile the crate. Cargo then uses this file to check when the crate needs to be recompiled.
There's no such thing as recompiling a file -- a unit of compilation is a crate, which can consist of a number of files.