Make gendeclarations.lua more friendly to incremental builds

Modify gendeclarations.lua to check if the generated non-static declaration
header changed before rewriting it with a new version. This is to prevent
unnecessary rebuilds of modules that depend on modules that had private changes.
This commit is contained in:
Thiago de Arruda
2014-06-02 15:32:50 -03:00
parent cab8cf970c
commit 4b787fb7d1

View File

@@ -227,6 +227,18 @@ F = io.open(static_fname, 'w')
F:write(static)
F:close()
-- Before generating the non-static headers, check if the current file(if
-- exists) is different from the new one. If they are the same, we won't touch
-- the current version to avoid triggering an unnecessary rebuilds of modules
-- that depend on this one
F = io.open(non_static_fname, 'r')
if F ~= nil then
if F:read('*a') == non_static then
os.exit(0)
end
io.close(F)
end
F = io.open(non_static_fname, 'w')
F:write(non_static)
F:close()