I'm not exactly sure how the Scons cache works. Is it by file contents?
If so, I think I could imagine implementing such a thing by creating a
wrapper script that takes a list of inputs, outputs, and a command
line. By hashing the inputs and command line together you could
compute a cache key and fetch the cached output; otherwise, you could
run the command and cache the output.
In the case where you fetch the cached output, updating a local copy
from the cache will cause the mtimes to update, so ninja will think
the output is up to date until you touch an input again.
Below you mentioned hard links. As you described, I think you can't
get the timestamps right when you use hard links. If it can't rely on
timestamps, a build system would need to rely on some other
information to judge whether a file is up to date.
I think a shared cache involving hard links would also rely on a
network file system of some sort (not sure I fully understand your
system), which also sounds
In Scons's case, I believe it uses file contents, but that means it
needs to read the contents of files when deciding what to build.
> I have some ideas, but wanted to see first if anyone already has
> experience doing it (or failing to do it). Thanks!
I'd be curious to hear your ideas, too. You've surely thought about
it more than me.
If so, I think I could imagine implementing such a thing by creating a
wrapper script that takes a list of inputs, outputs, and a command
line.
In the case where you fetch the cached output, updating a local copy
from the cache will cause the mtimes to update, so ninja will think
the output is up to date until you touch an input again.
In Scons's case, I believe it uses file contents, but that means it
needs to read the contents of files when deciding what to build.
Thanks for the link! I am unclear how the dynamic dependency detection
(depfiles) are done in that system. Do you know? Are programmers
expected to add a line to a BUILD file every time they add a #include?
I've been experimenting with caching ideas around ninja, and promise
to report back soon.