mirror of
https://github.com/natnat-mc/moonbuild
synced 2026-05-28 09:39:40 +02:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f20dd6a777 | |||
| 775d689e0a | |||
| 9450ec9c9d | |||
| de7ab2ddbf |
+10
-8
@@ -1,8 +1,9 @@
|
|||||||
-- load everything we need
|
-- load everything we need
|
||||||
import loadfile from require 'moonscript.base'
|
import loadfile from require 'moonscript.base'
|
||||||
import Context, DepGraph, Executor from require 'moonbuild'
|
import Context, DepGraph, Executor from require 'moonbuild'
|
||||||
Variable = (require 'moonbuild')['core.Variable']
|
Variable = require 'moonbuild.core.Variable'
|
||||||
import parseargs from (require 'moonbuild')['_cmd.common']
|
import verbose from require 'moonbuild._common'
|
||||||
|
import parseargs from require 'moonbuild._cmd.common'
|
||||||
argparse = require 'argparse'
|
argparse = require 'argparse'
|
||||||
import sort, concat from table
|
import sort, concat from table
|
||||||
import exit from os
|
import exit from os
|
||||||
@@ -34,12 +35,13 @@ for set in *args.set_list
|
|||||||
|
|
||||||
args.parallel = args.parallel == 'y' and 'y' or ((tonumber args.parallel) or error "Invalid argument for -j: #{args.parallel}")
|
args.parallel = args.parallel == 'y' and 'y' or ((tonumber args.parallel) or error "Invalid argument for -j: #{args.parallel}")
|
||||||
error "Invalid argument for -j: #{args.parallel}" if args.parallel != 'y' and (args.parallel<1 or args.parallel%1 != 0)
|
error "Invalid argument for -j: #{args.parallel}" if args.parallel != 'y' and (args.parallel<1 or args.parallel%1 != 0)
|
||||||
print "Parsed CLI args" if args.verbose
|
verbose args.verbose or false
|
||||||
|
verbose "Parsed CLI args"
|
||||||
|
|
||||||
-- load the buildfile
|
-- load the buildfile
|
||||||
ctx = Context!
|
ctx = Context!
|
||||||
ctx\load (loadfile args.buildfile), overrides
|
ctx\load (loadfile args.buildfile), overrides
|
||||||
print "Loaded buildfile" if args.verbose
|
verbose "Loaded buildfile"
|
||||||
|
|
||||||
-- handle -l and -V
|
-- handle -l and -V
|
||||||
if args.list
|
if args.list
|
||||||
@@ -65,16 +67,16 @@ if args.list_variables
|
|||||||
|
|
||||||
-- initialize the buildfile further
|
-- initialize the buildfile further
|
||||||
ctx\init!
|
ctx\init!
|
||||||
print "Initialized buildfile" if args.verbose
|
verbose "Initialized buildfile"
|
||||||
|
|
||||||
-- create the DAG
|
-- create the DAG
|
||||||
targets = #args.targets==0 and ctx.defaulttargets or args.targets
|
targets = #args.targets==0 and ctx.defaulttargets or args.targets
|
||||||
dag = DepGraph ctx, targets
|
dag = DepGraph ctx, targets
|
||||||
print "Created dependancy graph" if args.verbose
|
verbose print "Created dependancy graph"
|
||||||
|
|
||||||
-- execute the build
|
-- execute the build
|
||||||
nparallel = args.parallel == 'y' and Executor\getmaxparallel! or args.parallel
|
nparallel = args.parallel == 'y' and Executor\getmaxparallel! or args.parallel
|
||||||
print "Building with #{nparallel} max parallel process#{nparallel>1 and "es" or ""}" if args.verbose
|
verbose "Building with #{nparallel} max parallel process#{nparallel>1 and "es" or ""}"
|
||||||
executor = Executor dag, nparallel
|
executor = Executor dag, nparallel
|
||||||
executor\execute args
|
executor\execute args
|
||||||
print "Finished" if args.verbose
|
verbose "Finished"
|
||||||
|
|||||||
+13
-1
@@ -1,4 +1,5 @@
|
|||||||
import parseargs, escape from require 'moonbuild._cmd.common'
|
import parseargs, escape, cmdline from require 'moonbuild._cmd.common'
|
||||||
|
import verbose from require 'moonbuild._common'
|
||||||
|
|
||||||
ok, cmd, backend = false, nil, nil
|
ok, cmd, backend = false, nil, nil
|
||||||
unless ok
|
unless ok
|
||||||
@@ -17,6 +18,17 @@ cmd.backend = backend
|
|||||||
cmd.parseargs = parseargs
|
cmd.parseargs = parseargs
|
||||||
cmd.escape = escape
|
cmd.escape = escape
|
||||||
|
|
||||||
|
-- make verbose verisons of _.cmd, _.cmdrst and _.sh
|
||||||
|
for f in *({'cmd', 'cmdrst'})
|
||||||
|
orig = cmd[f]
|
||||||
|
cmd[f] = (...) ->
|
||||||
|
verbose "[#{f}] #{cmdline ...}"
|
||||||
|
orig ...
|
||||||
|
_sh = cmd.sh
|
||||||
|
cmd.sh = (cli) ->
|
||||||
|
verbose "[sh] #{cli}"
|
||||||
|
_sh cli
|
||||||
|
|
||||||
-- derived cmd functions
|
-- derived cmd functions
|
||||||
_cmd = cmd.cmd
|
_cmd = cmd.cmd
|
||||||
_cmdrst = cmd.cmdrst
|
_cmdrst = cmd.cmdrst
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import gsub, sub, match from string
|
import gsub, sub, match from string
|
||||||
import concat from table
|
import concat from table
|
||||||
|
import flatten from require 'moonbuild._common'
|
||||||
|
|
||||||
specialchars =
|
specialchars =
|
||||||
'\"': '\\\"'
|
'\"': '\\\"'
|
||||||
@@ -115,7 +116,11 @@ parseargs = (argstr) ->
|
|||||||
|
|
||||||
args
|
args
|
||||||
|
|
||||||
|
cmdline = (...) ->
|
||||||
|
concat [escape arg for arg in *flatten ...], ' '
|
||||||
|
|
||||||
{
|
{
|
||||||
:escape
|
:escape
|
||||||
:parseargs
|
:parseargs
|
||||||
|
:cmdline
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
import escape from require 'moonbuild._cmd.common'
|
import cmdline from require 'moonbuild._cmd.common'
|
||||||
import flatten from require 'moonbuild._common'
|
import flatten from require 'moonbuild._common'
|
||||||
import execute from require 'moonbuild.compat.execute'
|
import execute from require 'moonbuild.compat.execute'
|
||||||
import popen from io
|
import popen from io
|
||||||
import concat from table
|
import concat from table
|
||||||
|
|
||||||
cmdline = (...) ->
|
|
||||||
concat [escape arg for arg in *flatten ...], ' '
|
|
||||||
|
|
||||||
cmd = (...) ->
|
cmd = (...) ->
|
||||||
ok, ret, code = execute cmdline ...
|
ok, ret, code = execute cmdline ...
|
||||||
error "command #{first ...} exited with #{code} (#{ret})" unless ok
|
error "command #{first ...} exited with #{code} (#{ret})" unless ok
|
||||||
@@ -19,6 +16,7 @@ cmdrst = (...) ->
|
|||||||
data
|
data
|
||||||
|
|
||||||
sh = (cli) ->
|
sh = (cli) ->
|
||||||
|
verbose -> print '[sh] ' .. cli
|
||||||
ok, ret, code = execute cli
|
ok, ret, code = execute cli
|
||||||
error "command '#{cli}' exited with #{code} (#{ret})" unless ok
|
error "command '#{cli}' exited with #{code} (#{ret})" unless ok
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ cmdrst = (...) ->
|
|||||||
data
|
data
|
||||||
|
|
||||||
sh = (cli) ->
|
sh = (cli) ->
|
||||||
|
verbose -> print '[sh] ' .. cli
|
||||||
cmd 'sh', '-c', cli
|
cmd 'sh', '-c', cli
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -147,6 +147,19 @@ minmax = (list) ->
|
|||||||
M = e if e>M
|
M = e if e>M
|
||||||
m, M
|
m, M
|
||||||
|
|
||||||
|
_verbose = false
|
||||||
|
verbose = (arg) ->
|
||||||
|
if arg == nil
|
||||||
|
_verbose
|
||||||
|
elseif (type arg) == 'function'
|
||||||
|
arg! if _verbose
|
||||||
|
elseif (type arg) == 'boolean'
|
||||||
|
_verbose = arg
|
||||||
|
elseif (type arg) == 'string'
|
||||||
|
print arg if _verbose
|
||||||
|
else
|
||||||
|
error "_.verbose takes either no argument, a boolean, a function or a string"
|
||||||
|
|
||||||
common.flatten = flatten
|
common.flatten = flatten
|
||||||
common.first = first
|
common.first = first
|
||||||
common.foreach = foreach
|
common.foreach = foreach
|
||||||
@@ -159,5 +172,6 @@ common.exclude = exclude
|
|||||||
common.min = min
|
common.min = min
|
||||||
common.max = max
|
common.max = max
|
||||||
common.minmax = minmax
|
common.minmax = minmax
|
||||||
|
common.verbose = verbose
|
||||||
|
|
||||||
setmetatable common, __call: => [k for k in pairs common]
|
setmetatable common, __call: => [k for k in pairs common]
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import to_lua from require 'moonscript.base'
|
import to_lua from require 'moonscript.base'
|
||||||
import parseargs, cmdrst from require 'moonbuild._cmd'
|
import parseargs, cmdrst from require 'moonbuild._cmd'
|
||||||
|
import verbose from require 'moonbuild._common'
|
||||||
import gmatch, match, gsub from string
|
import gmatch, match, gsub from string
|
||||||
import open from io
|
import open from io
|
||||||
|
|
||||||
@@ -34,6 +35,7 @@ writefile = (filename, data) ->
|
|||||||
nil
|
nil
|
||||||
|
|
||||||
moonc = (infile, outfile) ->
|
moonc = (infile, outfile) ->
|
||||||
|
verbose "[moonc] #{infile} #{outfile}"
|
||||||
code, err = to_lua readfile infile
|
code, err = to_lua readfile infile
|
||||||
error "Failed to compile #{@infile}: #{err}" unless code
|
error "Failed to compile #{@infile}: #{err}" unless code
|
||||||
writefile outfile, code
|
writefile outfile, code
|
||||||
|
|||||||
+8
-5
@@ -33,22 +33,25 @@ moonbuild = (...) ->
|
|||||||
verbose = opts.verbose or opts.v or false
|
verbose = opts.verbose or opts.v or false
|
||||||
opts.verbose = verbose
|
opts.verbose = verbose
|
||||||
|
|
||||||
|
-- set verbosity level
|
||||||
|
_.verbose verbose
|
||||||
|
|
||||||
-- create context and DAG
|
-- create context and DAG
|
||||||
ctx = Context!
|
ctx = Context!
|
||||||
ctx\load (loadfile buildfile), opts
|
ctx\load (loadfile buildfile), opts
|
||||||
print "Loaded buildfile" if verbose
|
_.verbose "Loaded buildfile"
|
||||||
ctx\init!
|
ctx\init!
|
||||||
print "Initialized buildfile" if verbose
|
_.verbose "Initialized buildfile"
|
||||||
targets = #opts==0 and ctx.defaulttargets or opts
|
targets = #opts==0 and ctx.defaulttargets or opts
|
||||||
dag = DepGraph ctx, targets
|
dag = DepGraph ctx, targets
|
||||||
print "Created dependancy graph" if verbose
|
_.verbose "Created dependancy graph"
|
||||||
|
|
||||||
-- and build
|
-- and build
|
||||||
nparallel = parallel == true and Executor\getmaxparallel! or parallel
|
nparallel = parallel == true and Executor\getmaxparallel! or parallel
|
||||||
print "Building with #{nparallel} max parallel process#{nparallel>1 and "es" or ""}" if verbose
|
_.verbose "Building with #{nparallel} max parallel process#{nparallel>1 and "es" or ""}"
|
||||||
executor = Executor dag, nparallel
|
executor = Executor dag, nparallel
|
||||||
executor\execute opts
|
executor\execute opts
|
||||||
print "Finished" if verbose
|
_.verbose "Finished"
|
||||||
|
|
||||||
table = {
|
table = {
|
||||||
:moonbuild, :_
|
:moonbuild, :_
|
||||||
|
|||||||
Generated
+11
-20
@@ -6,9 +6,11 @@ do
|
|||||||
local _obj_0 = require('moonbuild')
|
local _obj_0 = require('moonbuild')
|
||||||
Context, DepGraph, Executor = _obj_0.Context, _obj_0.DepGraph, _obj_0.Executor
|
Context, DepGraph, Executor = _obj_0.Context, _obj_0.DepGraph, _obj_0.Executor
|
||||||
end
|
end
|
||||||
local Variable = (require('moonbuild'))['core.Variable']
|
local Variable = require('moonbuild.core.Variable')
|
||||||
|
local verbose
|
||||||
|
verbose = require('moonbuild._common').verbose
|
||||||
local parseargs
|
local parseargs
|
||||||
parseargs = (require('moonbuild'))['_cmd.common'].parseargs
|
parseargs = require('moonbuild._cmd.common').parseargs
|
||||||
local argparse = require('argparse')
|
local argparse = require('argparse')
|
||||||
local sort, concat
|
local sort, concat
|
||||||
do
|
do
|
||||||
@@ -55,14 +57,11 @@ args.parallel = args.parallel == 'y' and 'y' or ((tonumber(args.parallel)) or er
|
|||||||
if args.parallel ~= 'y' and (args.parallel < 1 or args.parallel % 1 ~= 0) then
|
if args.parallel ~= 'y' and (args.parallel < 1 or args.parallel % 1 ~= 0) then
|
||||||
error("Invalid argument for -j: " .. tostring(args.parallel))
|
error("Invalid argument for -j: " .. tostring(args.parallel))
|
||||||
end
|
end
|
||||||
if args.verbose then
|
verbose(args.verbose or false)
|
||||||
print("Parsed CLI args")
|
verbose("Parsed CLI args")
|
||||||
end
|
|
||||||
local ctx = Context()
|
local ctx = Context()
|
||||||
ctx:load((loadfile(args.buildfile)), overrides)
|
ctx:load((loadfile(args.buildfile)), overrides)
|
||||||
if args.verbose then
|
verbose("Loaded buildfile")
|
||||||
print("Loaded buildfile")
|
|
||||||
end
|
|
||||||
if args.list then
|
if args.list then
|
||||||
print("Public targets")
|
print("Public targets")
|
||||||
local targets, n = { }, 1
|
local targets, n = { }, 1
|
||||||
@@ -94,20 +93,12 @@ if args.list_variables then
|
|||||||
exit(0)
|
exit(0)
|
||||||
end
|
end
|
||||||
ctx:init()
|
ctx:init()
|
||||||
if args.verbose then
|
verbose("Initialized buildfile")
|
||||||
print("Initialized buildfile")
|
|
||||||
end
|
|
||||||
local targets = #args.targets == 0 and ctx.defaulttargets or args.targets
|
local targets = #args.targets == 0 and ctx.defaulttargets or args.targets
|
||||||
local dag = DepGraph(ctx, targets)
|
local dag = DepGraph(ctx, targets)
|
||||||
if args.verbose then
|
verbose(print("Created dependancy graph"))
|
||||||
print("Created dependancy graph")
|
|
||||||
end
|
|
||||||
local nparallel = args.parallel == 'y' and Executor:getmaxparallel() or args.parallel
|
local nparallel = args.parallel == 'y' and Executor:getmaxparallel() or args.parallel
|
||||||
if args.verbose then
|
verbose("Building with " .. tostring(nparallel) .. " max parallel process" .. tostring(nparallel > 1 and "es" or ""))
|
||||||
print("Building with " .. tostring(nparallel) .. " max parallel process" .. tostring(nparallel > 1 and "es" or ""))
|
|
||||||
end
|
|
||||||
local executor = Executor(dag, nparallel)
|
local executor = Executor(dag, nparallel)
|
||||||
executor:execute(args)
|
executor:execute(args)
|
||||||
if args.verbose then
|
return verbose("Finished")
|
||||||
return print("Finished")
|
|
||||||
end
|
|
||||||
Generated
+79
-37
@@ -36,11 +36,13 @@ end
|
|||||||
do
|
do
|
||||||
local _ENV = _ENV
|
local _ENV = _ENV
|
||||||
package.preload[ "moonbuild._cmd" ] = function( ... ) local arg = _G.arg;
|
package.preload[ "moonbuild._cmd" ] = function( ... ) local arg = _G.arg;
|
||||||
local parseargs, escape
|
local parseargs, escape, cmdline
|
||||||
do
|
do
|
||||||
local _obj_0 = require('moonbuild._cmd.common')
|
local _obj_0 = require('moonbuild._cmd.common')
|
||||||
parseargs, escape = _obj_0.parseargs, _obj_0.escape
|
parseargs, escape, cmdline = _obj_0.parseargs, _obj_0.escape, _obj_0.cmdline
|
||||||
end
|
end
|
||||||
|
local verbose
|
||||||
|
verbose = require('moonbuild._common').verbose
|
||||||
local ok, cmd, backend = false, nil, nil
|
local ok, cmd, backend = false, nil, nil
|
||||||
if not (ok) then
|
if not (ok) then
|
||||||
ok, cmd = pcall(function()
|
ok, cmd = pcall(function()
|
||||||
@@ -67,6 +69,23 @@ end
|
|||||||
cmd.backend = backend
|
cmd.backend = backend
|
||||||
cmd.parseargs = parseargs
|
cmd.parseargs = parseargs
|
||||||
cmd.escape = escape
|
cmd.escape = escape
|
||||||
|
local _list_0 = ({
|
||||||
|
'cmd',
|
||||||
|
'cmdrst'
|
||||||
|
})
|
||||||
|
for _index_0 = 1, #_list_0 do
|
||||||
|
local f = _list_0[_index_0]
|
||||||
|
local orig = cmd[f]
|
||||||
|
cmd[f] = function(...)
|
||||||
|
verbose("[" .. tostring(f) .. "] " .. tostring(cmdline(...)))
|
||||||
|
return orig(...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local _sh = cmd.sh
|
||||||
|
cmd.sh = function(cli)
|
||||||
|
verbose("[sh] " .. tostring(cli))
|
||||||
|
return _sh(cli)
|
||||||
|
end
|
||||||
local _cmd = cmd.cmd
|
local _cmd = cmd.cmd
|
||||||
local _cmdrst = cmd.cmdrst
|
local _cmdrst = cmd.cmdrst
|
||||||
cmd.cmdline = function(cmdline)
|
cmd.cmdline = function(cmdline)
|
||||||
@@ -99,6 +118,8 @@ do
|
|||||||
end
|
end
|
||||||
local concat
|
local concat
|
||||||
concat = table.concat
|
concat = table.concat
|
||||||
|
local flatten
|
||||||
|
flatten = require('moonbuild._common').flatten
|
||||||
local specialchars = {
|
local specialchars = {
|
||||||
['\"'] = '\\\"',
|
['\"'] = '\\\"',
|
||||||
['\\'] = '\\\\',
|
['\\'] = '\\\\',
|
||||||
@@ -230,26 +251,6 @@ parseargs = function(argstr)
|
|||||||
end
|
end
|
||||||
return args
|
return args
|
||||||
end
|
end
|
||||||
return {
|
|
||||||
escape = escape,
|
|
||||||
parseargs = parseargs
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
do
|
|
||||||
local _ENV = _ENV
|
|
||||||
package.preload[ "moonbuild._cmd.lua" ] = function( ... ) local arg = _G.arg;
|
|
||||||
local escape
|
|
||||||
escape = require('moonbuild._cmd.common').escape
|
|
||||||
local flatten
|
|
||||||
flatten = require('moonbuild._common').flatten
|
|
||||||
local execute
|
|
||||||
execute = require('moonbuild.compat.execute').execute
|
|
||||||
local popen
|
|
||||||
popen = io.popen
|
|
||||||
local concat
|
|
||||||
concat = table.concat
|
|
||||||
local cmdline
|
local cmdline
|
||||||
cmdline = function(...)
|
cmdline = function(...)
|
||||||
return concat((function(...)
|
return concat((function(...)
|
||||||
@@ -264,6 +265,27 @@ cmdline = function(...)
|
|||||||
return _accum_0
|
return _accum_0
|
||||||
end)(...), ' ')
|
end)(...), ' ')
|
||||||
end
|
end
|
||||||
|
return {
|
||||||
|
escape = escape,
|
||||||
|
parseargs = parseargs,
|
||||||
|
cmdline = cmdline
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
do
|
||||||
|
local _ENV = _ENV
|
||||||
|
package.preload[ "moonbuild._cmd.lua" ] = function( ... ) local arg = _G.arg;
|
||||||
|
local cmdline
|
||||||
|
cmdline = require('moonbuild._cmd.common').cmdline
|
||||||
|
local flatten
|
||||||
|
flatten = require('moonbuild._common').flatten
|
||||||
|
local execute
|
||||||
|
execute = require('moonbuild.compat.execute').execute
|
||||||
|
local popen
|
||||||
|
popen = io.popen
|
||||||
|
local concat
|
||||||
|
concat = table.concat
|
||||||
local cmd
|
local cmd
|
||||||
cmd = function(...)
|
cmd = function(...)
|
||||||
local ok, ret, code = execute(cmdline(...))
|
local ok, ret, code = execute(cmdline(...))
|
||||||
@@ -283,6 +305,9 @@ cmdrst = function(...)
|
|||||||
end
|
end
|
||||||
local sh
|
local sh
|
||||||
sh = function(cli)
|
sh = function(cli)
|
||||||
|
verbose(function()
|
||||||
|
return print('[sh] ' .. cli)
|
||||||
|
end)
|
||||||
local ok, ret, code = execute(cli)
|
local ok, ret, code = execute(cli)
|
||||||
if not (ok) then
|
if not (ok) then
|
||||||
return error("command '" .. tostring(cli) .. "' exited with " .. tostring(code) .. " (" .. tostring(ret) .. ")")
|
return error("command '" .. tostring(cli) .. "' exited with " .. tostring(code) .. " (" .. tostring(ret) .. ")")
|
||||||
@@ -354,6 +379,9 @@ cmdrst = function(...)
|
|||||||
end
|
end
|
||||||
local sh
|
local sh
|
||||||
sh = function(cli)
|
sh = function(cli)
|
||||||
|
verbose(function()
|
||||||
|
return print('[sh] ' .. cli)
|
||||||
|
end)
|
||||||
return cmd('sh', '-c', cli)
|
return cmd('sh', '-c', cli)
|
||||||
end
|
end
|
||||||
return {
|
return {
|
||||||
@@ -635,6 +663,25 @@ minmax = function(list)
|
|||||||
end
|
end
|
||||||
return m, M
|
return m, M
|
||||||
end
|
end
|
||||||
|
local _verbose = false
|
||||||
|
local verbose
|
||||||
|
verbose = function(arg)
|
||||||
|
if arg == nil then
|
||||||
|
return _verbose
|
||||||
|
elseif (type(arg)) == 'function' then
|
||||||
|
if _verbose then
|
||||||
|
return arg()
|
||||||
|
end
|
||||||
|
elseif (type(arg)) == 'boolean' then
|
||||||
|
_verbose = arg
|
||||||
|
elseif (type(arg)) == 'string' then
|
||||||
|
if _verbose then
|
||||||
|
return print(arg)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return error("_.verbose takes either no argument, a boolean, a function or a string")
|
||||||
|
end
|
||||||
|
end
|
||||||
common.flatten = flatten
|
common.flatten = flatten
|
||||||
common.first = first
|
common.first = first
|
||||||
common.foreach = foreach
|
common.foreach = foreach
|
||||||
@@ -647,6 +694,7 @@ common.exclude = exclude
|
|||||||
common.min = min
|
common.min = min
|
||||||
common.max = max
|
common.max = max
|
||||||
common.minmax = minmax
|
common.minmax = minmax
|
||||||
|
common.verbose = verbose
|
||||||
return setmetatable(common, {
|
return setmetatable(common, {
|
||||||
__call = function(self)
|
__call = function(self)
|
||||||
local _accum_0 = { }
|
local _accum_0 = { }
|
||||||
@@ -1260,6 +1308,8 @@ do
|
|||||||
local _obj_0 = require('moonbuild._cmd')
|
local _obj_0 = require('moonbuild._cmd')
|
||||||
parseargs, cmdrst = _obj_0.parseargs, _obj_0.cmdrst
|
parseargs, cmdrst = _obj_0.parseargs, _obj_0.cmdrst
|
||||||
end
|
end
|
||||||
|
local verbose
|
||||||
|
verbose = require('moonbuild._common').verbose
|
||||||
local gmatch, match, gsub
|
local gmatch, match, gsub
|
||||||
do
|
do
|
||||||
local _obj_0 = string
|
local _obj_0 = string
|
||||||
@@ -1331,6 +1381,7 @@ writefile = function(filename, data)
|
|||||||
end
|
end
|
||||||
local moonc
|
local moonc
|
||||||
moonc = function(infile, outfile)
|
moonc = function(infile, outfile)
|
||||||
|
verbose("[moonc] " .. tostring(infile) .. " " .. tostring(outfile))
|
||||||
local code, err = to_lua(readfile(infile))
|
local code, err = to_lua(readfile(infile))
|
||||||
if not (code) then
|
if not (code) then
|
||||||
error("Failed to compile " .. tostring(self.infile) .. ": " .. tostring(err))
|
error("Failed to compile " .. tostring(self.infile) .. ": " .. tostring(err))
|
||||||
@@ -2830,29 +2881,20 @@ moonbuild = function(...)
|
|||||||
opts.force = force
|
opts.force = force
|
||||||
local verbose = opts.verbose or opts.v or false
|
local verbose = opts.verbose or opts.v or false
|
||||||
opts.verbose = verbose
|
opts.verbose = verbose
|
||||||
|
_.verbose(verbose)
|
||||||
local ctx = Context()
|
local ctx = Context()
|
||||||
ctx:load((loadfile(buildfile)), opts)
|
ctx:load((loadfile(buildfile)), opts)
|
||||||
if verbose then
|
_.verbose("Loaded buildfile")
|
||||||
print("Loaded buildfile")
|
|
||||||
end
|
|
||||||
ctx:init()
|
ctx:init()
|
||||||
if verbose then
|
_.verbose("Initialized buildfile")
|
||||||
print("Initialized buildfile")
|
|
||||||
end
|
|
||||||
local targets = #opts == 0 and ctx.defaulttargets or opts
|
local targets = #opts == 0 and ctx.defaulttargets or opts
|
||||||
local dag = DepGraph(ctx, targets)
|
local dag = DepGraph(ctx, targets)
|
||||||
if verbose then
|
_.verbose("Created dependancy graph")
|
||||||
print("Created dependancy graph")
|
|
||||||
end
|
|
||||||
local nparallel = parallel == true and Executor:getmaxparallel() or parallel
|
local nparallel = parallel == true and Executor:getmaxparallel() or parallel
|
||||||
if verbose then
|
_.verbose("Building with " .. tostring(nparallel) .. " max parallel process" .. tostring(nparallel > 1 and "es" or ""))
|
||||||
print("Building with " .. tostring(nparallel) .. " max parallel process" .. tostring(nparallel > 1 and "es" or ""))
|
|
||||||
end
|
|
||||||
local executor = Executor(dag, nparallel)
|
local executor = Executor(dag, nparallel)
|
||||||
executor:execute(opts)
|
executor:execute(opts)
|
||||||
if verbose then
|
return _.verbose("Finished")
|
||||||
return print("Finished")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
local table = {
|
local table = {
|
||||||
moonbuild = moonbuild,
|
moonbuild = moonbuild,
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
build = {
|
||||||
|
install = {
|
||||||
|
bin = {
|
||||||
|
moonbuild = "out/moonbuild"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
modules = {
|
||||||
|
moonbuild = "out/moonbuild.lua"
|
||||||
|
},
|
||||||
|
type = "builtin"
|
||||||
|
}
|
||||||
|
dependencies = {
|
||||||
|
"lua >= 5.1",
|
||||||
|
"argparse >= 0.7.1-1",
|
||||||
|
"moonscript >= 0.5.0-1"
|
||||||
|
}
|
||||||
|
description = {
|
||||||
|
detailed = "moonbuild is a small build system that simplifies your build definitions by allowing you to use declarative as well as imperative rules. It represents the build as a DAG with explicit ordering, and doesn't give you any default confusing rules (unlike make). If you can, installing luaposix and/or luafilesystem will speed up builds and increase stability.\n",
|
||||||
|
summary = "Small build system in between make and a build.sh"
|
||||||
|
}
|
||||||
|
package = "moonbuild"
|
||||||
|
rockspec_format = "3.0"
|
||||||
|
source = {
|
||||||
|
tag = "v2.7.0",
|
||||||
|
url = "git+http://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.7.0-1"
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
build = {
|
||||||
|
install = {
|
||||||
|
bin = {
|
||||||
|
moonbuild = "out/moonbuild"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
modules = {
|
||||||
|
moonbuild = "out/moonbuild.lua"
|
||||||
|
},
|
||||||
|
type = "builtin"
|
||||||
|
}
|
||||||
|
dependencies = {
|
||||||
|
"lua >= 5.1",
|
||||||
|
"argparse >= 0.7.1-1",
|
||||||
|
"moonscript >= 0.5.0-1"
|
||||||
|
}
|
||||||
|
description = {
|
||||||
|
detailed = "moonbuild is a small build system that simplifies your build definitions by allowing you to use declarative as well as imperative rules. It represents the build as a DAG with explicit ordering, and doesn't give you any default confusing rules (unlike make). If you can, installing luaposix and/or luafilesystem will speed up builds and increase stability.\n",
|
||||||
|
summary = "Small build system in between make and a build.sh"
|
||||||
|
}
|
||||||
|
package = "moonbuild"
|
||||||
|
rockspec_format = "3.0"
|
||||||
|
source = {
|
||||||
|
tag = "v2.7.1",
|
||||||
|
url = "git+http://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.7.1-1"
|
||||||
Reference in New Issue
Block a user