Build/Core/ResourceCompiler/ResourceCompiler.lua
2022-03-05 19:41:11 +00:00

33 lines
935 B
Lua

local function resourceCompile(files, additional, script)
auForEach(files, _G.files)
local absFiles = {}
auForEach(files, function(file)
table.insert(absFiles, os.realpath(file))
end)
local cur = auGetCurrentProjectMeta()
local projScript = nil
if (cur and cur.path) then
projScript = path.join(cur.path, script)
end
local userScript = path.join(Aurora.Settings.sAbsRepoScripts, script)
if (os.isfile(userScript)) then
script = userScript
elseif (projScript and os.isfile(projScript)) then
script = projScript
end
local meta = {
script = script,
files = absFiles,
ext = additional,
hash = string.sha1(json.encode(files) .. json.encode(additional or ""))
}
auAddBuildAction("pre", "lua", path.join(Aurora.Settings.sAbsScripts, "Core", "ResourceCompiler", "run.lua"), true, meta)
end
return resourceCompile