Avoid updating target file mtime in 'generate'#3980
Conversation
If the target file exists on disk already, compare its contents to the generated source in memory: only update the target file on disk if the contents differ or if the target file is missing. This should allow build tools downstream of sqlc to make conditional decisions based on whether the generated code files have been updated (e.g. mockgen).
7874bd9 to
916bfbf
Compare
|
@kyleconroy small nudge here: is this a change that you're okay with? |
|
Seems like a good idea and pretty cheap to do. I'll hold off on a review until @kyleconroy weighs in. |
|
@kyleconroy gentle ping? :) |
|
@andrewmbenton @kyleconroy Sorry for being a nuisance, but I figured I'd check in once more before the end of the year: is there any chance we can get this merged? (Of course if you have feedback I'm all ears!) |
|
Also curious about this, as I'd like to have my "make build" target generate the sqlc output just like it does for Templ & our Tailwind CSS output.. Currently though, if I use that build target with |
|
It's been a year; I am closing this since I assume it is not wanted. |
If the target file exists on disk already, compare its contents to the generated source in memory: only update the target file on disk if the contents differ or if the target file is missing.
This should allow build tools downstream of sqlc to make conditional decisions based on whether the generated code files have been updated (e.g. mockgen).