63 lines
1.4 KiB
Lua
63 lines
1.4 KiB
Lua
local timestampMap = {}
|
|
local timestampMapCache = {}
|
|
|
|
auForEach(auBuild.args.files, function(file)
|
|
timestampMap[file] = os.stat(file).mtime
|
|
end)
|
|
|
|
local cachePath = path.join(Aurora.Settings.sAbsCompilerWd, auBuild.args.hash) .. ".rsc"
|
|
|
|
if (os.isfile(cachePath)) then
|
|
timestampMapCache = json.decode(io.readfile(cachePath))
|
|
end
|
|
|
|
io.writefile(cachePath, json.encode(timestampMap))
|
|
|
|
local changedFiles = {}
|
|
local unchangedFiles = {}
|
|
|
|
if (type(timestampMapCache) == "table") then
|
|
auForEachKV(timestampMap, function(file, changed)
|
|
if (timestampMapCache[file] == changed) then
|
|
table.insert(unchangedFiles, file)
|
|
else
|
|
table.insert(changedFiles, file)
|
|
end
|
|
end)
|
|
else
|
|
auForEachKV(timestampMap, function(file, changed)
|
|
table.insert(changedFiles, file)
|
|
end)
|
|
end
|
|
|
|
auResourceCompiler = {
|
|
unchangedFiles = unchangedFiles,
|
|
changedFiles = changedFiles,
|
|
arguments = auBuild.args.ext
|
|
}
|
|
|
|
function resourceExit(exitCode)
|
|
if (not exitCode) then
|
|
os.remove(cachePath)
|
|
end
|
|
|
|
os.exit(exitCode)
|
|
end
|
|
|
|
function resourceRun(cmd)
|
|
if (os.host() == "windows") then
|
|
return os.execute("call " .. cmd)
|
|
else
|
|
return os.execute(cmd)
|
|
end
|
|
end
|
|
|
|
function resourceRunAndExit(cmd)
|
|
if (os.host() == "windows") then
|
|
resourceExit(os.execute("call " .. cmd))
|
|
else
|
|
resourceExit(os.execute(cmd))
|
|
end
|
|
end
|
|
|
|
auRequireAbs(auBuild.args.script) |