Evil multitargetting

This commit is contained in:
marked 2025-03-12 21:21:41 +01:00
parent f9edec572a
commit 9bed4a8cb1
4 changed files with 54 additions and 8 deletions

View file

@ -7,6 +7,7 @@ local stdio = require("@lune/stdio")
local progress_bar = require("./util/progress")
local result = require("./util/result")
local shared = require("./shared")
local tbl = require("./util/tbl")
local types = require("./types")
local function make_pesde_manifest(version: string, scope: string): types.PesdeManifest
@ -94,6 +95,15 @@ local function release(origin: string, scopes: { wally: string?, pesde: string?
local manifest = make_pesde_manifest(version, scopes.pesde)
local encoded = serde.encode("toml", manifest)
fs.writeFile(`{origin}/pesde.toml`, encoded)
local rbx_manifest = tbl.deep_clone(manifest)
rbx_manifest.target = {
environment = "roblox",
lib = "jecs.luau",
build_files = { "jecs.luau" },
}
local encoded_rbx = serde.encode("toml", rbx_manifest)
fs.writeFile(`{origin}/pesde-rbx.toml`, encoded_rbx)
end
if scopes.wally then
@ -121,6 +131,29 @@ local function release(origin: string, scopes: { wally: string?, pesde: string?
end
end
local res_pesde_rbx
if scopes.pesde then
fs.move(`{origin}/pesde.toml`, `{origin}/pesde-luau.toml`)
fs.move(`{origin}/pesde-rbx.toml`, `{origin}/pesde.toml`)
process.spawn("pesde", { "install" }, { cwd = cwd })
if not dry then
res_pesde_rbx = process.spawn("pesde", { "publish", "-y" }, { cwd = cwd })
else
res_pesde_rbx = process.spawn("pesde", { "publish", "-d", "-y" }, { cwd = cwd })
end
fs.move(`{origin}/pesde.toml`, `{origin}/pesde-rbx.toml`)
fs.move(`{origin}/pesde-luau.toml`, `{origin}/pesde.toml`)
process.spawn("pesde", { "install" }, { cwd = cwd })
if not res_pesde_rbx.ok then
progress:stop()
print(`-- Pesde error:\nstdout\n{res_pesde_rbx.stdout}\nstderr\n{res_pesde_rbx.stderr}`)
return result(false, `Pesde error:\nstdout\n{res_pesde_rbx.stdout}\nstderr\n{res_pesde_rbx.stderr}`)
end
end
progress:nextStage() -- release (wally)
local res_wally

14
src/util/tbl.luau Normal file
View file

@ -0,0 +1,14 @@
--!strict
local function deep_clone<T>(t: T): T
local clone = table.clone(t :: any)
for k, v in clone do
if type(v) == "table" then
clone[k] = deep_clone(v)
end
end
return clone :: any
end
return {
deep_clone = deep_clone,
}