generated from marked/CSSharpTemplate
Initial commit
This commit is contained in:
commit
a44fe0dbe0
20 changed files with 1237 additions and 0 deletions
46
lune/manager/build.luau
Normal file
46
lune/manager/build.luau
Normal file
|
@ -0,0 +1,46 @@
|
|||
--!strict
|
||||
local common = require("./common")
|
||||
local progress_bar = require("@pkg/progress")
|
||||
local result = require("@pkg/result")
|
||||
|
||||
export type ReplicatorData = {
|
||||
remote_output: string,
|
||||
replicator: string,
|
||||
}
|
||||
local function build(configuration: string, replicator_data: ReplicatorData?)
|
||||
local progress = progress_bar.new():with_stage("init", "Initializing"):with_stage("build", "Building project")
|
||||
if replicator_data then
|
||||
progress:with_stage("replicate", "Replicating to remote server")
|
||||
end
|
||||
|
||||
progress:start() -- init
|
||||
|
||||
progress:next_stage() -- build
|
||||
|
||||
local build_result = common.spawn(`dotnet build -c {configuration}`)
|
||||
if not build_result.ok then
|
||||
progress:stop()
|
||||
return result(false, `Failed to build:\n{build_result.err}`)
|
||||
end
|
||||
|
||||
if replicator_data then
|
||||
progress:next_stage() -- replicate
|
||||
|
||||
progress:pause()
|
||||
local replicator: common.Replicator = (require)(`./replicators/{replicator_data.replicator}`)
|
||||
local replication_result = replicator(`src/bin/{configuration}/net8.0`, replicator_data.remote_output)
|
||||
if not replication_result.ok then
|
||||
progress:stop()
|
||||
return result(false, `Failed to replicate build:\n{replication_result.err}`)
|
||||
end
|
||||
progress:unpause()
|
||||
end
|
||||
|
||||
progress:stop() -- finish
|
||||
|
||||
print(build_result.val.stdout)
|
||||
|
||||
return result(true, nil)
|
||||
end
|
||||
|
||||
return build
|
Loading…
Add table
Add a link
Reference in a new issue