Remove assets from repository and download them using xmake
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
-- Compile shaders to includables headers
|
||||
rule("compile_shaders")
|
||||
rule("nzsl.compile.shaders")
|
||||
on_load(function (target)
|
||||
target:add("packages", "nzsl")
|
||||
end)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
-- Adds -d as a debug suffix
|
||||
rule("debug_suffix")
|
||||
rule("debug.suffix")
|
||||
on_load(function (target)
|
||||
if target:kind() ~= "binary" then
|
||||
target:set("basename", target:basename() .. "-d")
|
||||
target:set("suffixname", "-d")
|
||||
end
|
||||
end)
|
||||
|
||||
42
xmake/rules/download_assets.lua
Normal file
42
xmake/rules/download_assets.lua
Normal file
@@ -0,0 +1,42 @@
|
||||
local baseDownloadURL = "https://nazara.digitalpulse.software"
|
||||
|
||||
local function downloadAssetsRule(name)
|
||||
rule("download.assets." .. name)
|
||||
set_kind("project")
|
||||
before_build(function (opt)
|
||||
import("net.http")
|
||||
import("utils.archive")
|
||||
|
||||
local referenceVersion = io.readfile("assets/" .. name .. "_version.txt")
|
||||
local currentVersion = os.exists("assets/" .. name .. "/version.txt") and io.readfile("assets/" .. name .. "/version.txt")
|
||||
if referenceVersion == currentVersion then
|
||||
utils.vprintf(name .. " assets are up-to-date, ignoring\n")
|
||||
return
|
||||
end
|
||||
|
||||
local text = {}
|
||||
table.insert(text, currentVersion and "update " or "download ")
|
||||
table.insert(text, name)
|
||||
table.insert(text, " assets?")
|
||||
if currentVersion then
|
||||
table.insert(text, " current version is " .. currentVersion .. " and remote version is " .. referenceVersion)
|
||||
end
|
||||
table.insert(text, "\nthis is required to run them")
|
||||
|
||||
local confirm = utils.confirm({description = table.concat(text), default = true})
|
||||
if not confirm then
|
||||
utils.vprintf("aborting " .. name .. " assets downloading\n")
|
||||
return
|
||||
end
|
||||
|
||||
os.rm("assets/" .. name)
|
||||
http.download(baseDownloadURL .. "/assets_" .. name .. ".zip", "assets_" .. name .. ".zip")
|
||||
archive.extract("assets_" .. name .. ".zip", "assets")
|
||||
os.rm("assets_" .. name .. ".zip")
|
||||
|
||||
print(name .. " assets downloaded!")
|
||||
end)
|
||||
end
|
||||
|
||||
downloadAssetsRule("examples")
|
||||
downloadAssetsRule("tests")
|
||||
@@ -1,5 +1,5 @@
|
||||
-- Turns resources into includables headers
|
||||
rule("embed_resources")
|
||||
rule("embed.resources")
|
||||
before_build(function (target, opt)
|
||||
import("core.base.option")
|
||||
if xmake.version():ge("2.5.9") then
|
||||
@@ -42,7 +42,7 @@ rule("embed_resources")
|
||||
end
|
||||
|
||||
for _, sourcebatch in pairs(target:sourcebatches()) do
|
||||
if sourcebatch.rulename == "embed_resources" then
|
||||
if sourcebatch.rulename == "embed.resources" then
|
||||
for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
|
||||
local targetpath = sourcefile .. ".h"
|
||||
if option.get("rebuild") or os.mtime(sourcefile) >= os.mtime(targetpath) then
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local modules = NazaraModules
|
||||
|
||||
-- Builds renderer plugins if linked to NazaraRenderer
|
||||
rule("build_rendererplugins")
|
||||
rule("build.rendererplugins")
|
||||
on_load(function (target)
|
||||
local deps = table.wrap(target:get("deps"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user