You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
604 B

function os.capture(cmd)
local f = io.popen(cmd, 'r')
if (f) then
local s = f:read('*a')
if (f:close()) then
return s
end
end
return nil
end
hash = (os.capture("git rev-parse HEAD") or "UnknownRevision"):gsub("\n$", "")
clean = ((os.capture("git diff --name-only") or "0"):gsub("\n$", "") == "") and "1" or "0"
local output = io.open(arg[1], "w")
if (output) then
output:write("// This file was automatically generated by buildinfo.lua\n#pragma once\n\n")
output:write("#define ETH_COMMIT_HASH "..hash.."\n")
output:write("#define ETH_CLEAN_REPO "..clean.."\n")
output:close()
end