mirror of
https://github.com/natnat-mc/moonbuild
synced 2026-05-28 09:39:40 +02:00
Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| de7ab2ddbf | |||
| 37ab4f2299 | |||
| 4cd18877a9 | |||
| 67eb978e43 | |||
| f51be8631b | |||
| 715aa2ebb7 | |||
| bed119a40c | |||
| 57126a7973 | |||
| cd9b0ab159 | |||
| 678313d09f | |||
| ebd380fb0f | |||
| 803d1093bb | |||
| ec5fc1cf7d | |||
| 17578bb721 | |||
| d3c8414086 | |||
| d43e9350d3 | |||
| 0f3506c7b7 | |||
| eb28c9c8bb | |||
| e0afeaaf07 | |||
| e13705f232 | |||
| c6004f1582 | |||
| ce942f9da8 | |||
| cc776ef24e | |||
| 603d09fc84 | |||
| 2b3337fc69 | |||
| 5518c61fc1 | |||
| 81baa03624 | |||
| 77f73f3a21 | |||
| 31fcc58ccd | |||
| fcf7c3fa07 | |||
| 88a8117f06 | |||
| 69e781bc8f | |||
| ee0d76db98 | |||
| 6a6334fc78 | |||
| e5bd85933a | |||
| 50d0c662c5 | |||
| f742a3c003 | |||
| fcd3b07572 | |||
| b1f57c8929 |
@@ -0,0 +1,3 @@
|
|||||||
|
*.lua linguist-generated
|
||||||
|
out/* linguist-generated
|
||||||
|
Makefile -linguist-detectable
|
||||||
+3
-1
@@ -1 +1,3 @@
|
|||||||
*.lua
|
bin/*.lua
|
||||||
|
moonbuild/*.lua
|
||||||
|
moonbuild/*/*.lua
|
||||||
|
|||||||
+9
-3
@@ -1,8 +1,14 @@
|
|||||||
|
require 'moonscript'
|
||||||
|
moonbuild = require 'moonbuild'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
build: =>
|
|
||||||
load 'moonbuild'
|
|
||||||
tasks.moonbuild j: true
|
|
||||||
release: =>
|
release: =>
|
||||||
error "no version provided" unless @v
|
error "no version provided" unless @v
|
||||||
tasks.build!
|
tasks.build!
|
||||||
sh "rockbuild -m -t #{@v} upload"
|
sh "rockbuild -m -t #{@v} upload"
|
||||||
|
|
||||||
|
watch: => watch {'.'}, {'.git'}, 'live', (glob '*.moon'), pcall -> moonbuild j: true
|
||||||
|
build: => moonbuild j: true
|
||||||
|
install: => moonbuild 'install', j: true
|
||||||
|
clean: => moonbuild 'clean'
|
||||||
|
mrproper: => moonbuild 'mrproper'
|
||||||
|
|||||||
+46
-30
@@ -1,46 +1,62 @@
|
|||||||
public var 'MOONC', 'moonc'
|
public var AMALG: 'amalg.lua'
|
||||||
public var 'AMALG', 'amalg.lua'
|
public var RM: 'rm', '-f', '--'
|
||||||
public var 'RM', 'rm', '-f', '--'
|
public var LUA: 'lua5.3'
|
||||||
public var 'LUA', 'lua5.3'
|
|
||||||
|
|
||||||
var 'LIB_SRC', _.wildcard 'moonbuild/**.moon'
|
var LIB_SRC: _.wildcard 'moonbuild/**.moon'
|
||||||
var 'BIN_SRC', _.wildcard 'bin/*.moon'
|
var BIN_SRC: _.wildcard 'bin/*.moon'
|
||||||
|
|
||||||
var 'LIB_LUA', _.patsubst LIB_SRC, '%.moon', '%.lua'
|
var LIB_LUA: _.patsubst LIB_SRC, '%.moon', '%.lua'
|
||||||
var 'BIN_LUA', _.patsubst BIN_SRC, '%.moon', '%.lua'
|
var BIN_LUA: _.patsubst BIN_SRC, '%.moon', '%.lua'
|
||||||
var 'BIN', _.patsubst BIN_LUA, 'bin/%.lua', 'out/%'
|
var BIN: _.patsubst BIN_LUA, 'bin/%.lua', 'out/%'
|
||||||
|
var LIB: 'out/moonbuild.lua'
|
||||||
|
|
||||||
var 'MODULES', _.foreach (_.patsubst LIB_LUA, '%.lua', '%'), => @gsub '/', '.'
|
var MODULES: _.foreach (_.patsubst LIB_LUA, '%.lua', '%'), => @gsub '/', '.'
|
||||||
|
|
||||||
with public default target 'all'
|
with public default target 'all'
|
||||||
\after 'bin'
|
\after 'bin'
|
||||||
\after 'lib'
|
\after 'lib'
|
||||||
|
|
||||||
|
with public target 'install'
|
||||||
|
\after 'install-bin'
|
||||||
|
\after 'install-lib'
|
||||||
|
|
||||||
|
with public target 'install-bin'
|
||||||
|
\depends BIN
|
||||||
|
\produces _.patsubst BIN, 'out/%', '/usr/local/bin/%'
|
||||||
|
\fn => _.cmd 'sudo', 'cp', @infile, @out
|
||||||
|
\sync!
|
||||||
|
|
||||||
|
with public target 'install-lib'
|
||||||
|
\depends LIB
|
||||||
|
\produces "/usr/local/share/lua/#{LUA\gsub 'lua', ''}/moonbuild.lua"
|
||||||
|
\fn => _.cmd 'sudo', 'cp', @infile, @out
|
||||||
|
\sync!
|
||||||
|
|
||||||
with public target 'clean'
|
with public target 'clean'
|
||||||
\fn => _.cmd RM, LIB_LUA
|
\fn => _.cmd RM, LIB_LUA
|
||||||
\fn => _.cmd RM, BIN_LUA
|
\fn => _.cmd RM, BIN_LUA
|
||||||
|
|
||||||
with public target 'mrproper'
|
with public target 'mrproper'
|
||||||
\after 'clean'
|
\after 'clean'
|
||||||
\fn => _.cmd RM, BIN
|
\fn => _.cmd RM, BIN, LIB
|
||||||
|
|
||||||
with public target 'bin'
|
with pipeline! -- lib
|
||||||
\depends BIN
|
\sources LIB_SRC
|
||||||
|
\step 'compile-lib'
|
||||||
|
pattern: {'%.moon', '%.lua'}
|
||||||
|
fn: => _.moonc @infile, @out
|
||||||
|
\step 'lib'
|
||||||
|
output: LIB
|
||||||
|
fn: => _.cmd AMALG, '-o', @out, '-s', 'moonbuild/init.lua', _.exclude MODULES, 'moonbuild.init'
|
||||||
|
|
||||||
with public target 'lib'
|
with pipeline! -- bin
|
||||||
\depends LIB_LUA
|
\sources BIN_SRC
|
||||||
|
\step 'compile-bin'
|
||||||
with target BIN, pattern: 'out/%'
|
pattern: {'%.moon', '%.lua'}
|
||||||
\depends 'bin/%.lua'
|
fn: => _.moonc @infile, @out
|
||||||
\depends LIB_LUA
|
\step 'bin'
|
||||||
\produces 'out/%'
|
pattern: {'bin/%.lua', 'out/%'}
|
||||||
\mkdirs!
|
mkdirs: true
|
||||||
\fn =>
|
fn: =>
|
||||||
_.cmd AMALG, '-o', @outfile, '-s', @infile, MODULES
|
_.writefile @out, "#!/usr/bin/env #{LUA}\n#{_.readfile @infile}"
|
||||||
_.writefile @outfile, "#!/usr/bin/env #{LUA}\n#{_.readfile @outfile}"
|
_.cmd 'chmod', '+x', @out
|
||||||
_.cmd 'chmod', '+x', @outfile
|
|
||||||
|
|
||||||
with target {LIB_LUA, BIN_LUA}, pattern: '%.lua'
|
|
||||||
\depends '%.moon'
|
|
||||||
\produces '%.lua'
|
|
||||||
\fn => _.moonc @infile, @outfile
|
|
||||||
|
|||||||
@@ -21,19 +21,22 @@ clean:
|
|||||||
$(RM) $(BIN_LUA)
|
$(RM) $(BIN_LUA)
|
||||||
|
|
||||||
mrproper: clean
|
mrproper: clean
|
||||||
$(RM) $(BIN)
|
$(RM) $(BIN) out/moonbuild.lua
|
||||||
|
|
||||||
bin: $(BIN)
|
bin: $(BIN)
|
||||||
|
|
||||||
lib: $(LIB_LUA)
|
lib: $(LIB_LUA) out/moonbuild.lua
|
||||||
|
|
||||||
out/%: bin/%.lua $(LIB_LUA)
|
out/%: bin/%.lua $(LIB_LUA)
|
||||||
@mkdir -p `dirname $@`
|
@mkdir -p `dirname $@`
|
||||||
$(AMALG) -o $@.body -s $< $(MODULES)
|
|
||||||
@printf '#!/usr/bin/env %s\n' $(LUA) > $@.headline
|
@printf '#!/usr/bin/env %s\n' $(LUA) > $@.headline
|
||||||
@cat $@.headline $@.body > $@
|
@cat $@.headline $< > $@
|
||||||
@rm $@.headline $@.body
|
@rm $@.headline
|
||||||
chmod +x $@
|
chmod +x $@
|
||||||
|
|
||||||
|
out/moonbuild.lua: moonbuild/init.lua $(LIB_LUA)
|
||||||
|
@mkdir -p `dirname $@`
|
||||||
|
$(AMALG) -o $@ -s $< $(MODULES)
|
||||||
|
|
||||||
%.lua: %.moon
|
%.lua: %.moon
|
||||||
moonc $^
|
moonc $^
|
||||||
|
|||||||
@@ -24,11 +24,13 @@ You will need `argparse` and `moonscript` installed from luarocks, and `luaposix
|
|||||||
|
|
||||||
### Bootstrapping
|
### Bootstrapping
|
||||||
You can build moonbuild with itself: `moon bin/moonbuild.moon -qjy`.
|
You can build moonbuild with itself: `moon bin/moonbuild.moon -qjy`.
|
||||||
This will leave the binary ready to be used as `out/moonbuild`.
|
This will leave the binary ready to be used as `out/moonbuild` (it will still depend on the library to be used).
|
||||||
|
The binary and library can then be installed with `bin/moonbuild install`.
|
||||||
|
|
||||||
### Using make
|
You can combine these steps with `moon bin/moonbuild.moon -qjy install` which will build and install moonbuild.
|
||||||
You can also build moonbuild with make: `make`.
|
|
||||||
This will leave the binary ready to be used as `out/moonbuild`.
|
### With `Alfons`
|
||||||
|
Alfons can use the devel version of moonbuild directly from its sources, so `alfons build` and `alfons install` will work directly.
|
||||||
|
|
||||||
## Docs
|
## Docs
|
||||||
TODO
|
TODO
|
||||||
|
|||||||
+8
-16
@@ -1,14 +1,13 @@
|
|||||||
-- load everything we need
|
-- load everything we need
|
||||||
import loadfile from require 'moonscript.base'
|
import loadfile from require 'moonscript.base'
|
||||||
Context = require 'moonbuild.context'
|
import Context, DepGraph, Executor from require 'moonbuild'
|
||||||
Variable = require 'moonbuild.core.Variable'
|
Variable = (require 'moonbuild')['core.Variable']
|
||||||
DepGraph = require 'moonbuild.core.DAG'
|
import parseargs from (require 'moonbuild')['_cmd.common']
|
||||||
import parseargs from require 'moonbuild._cmd.common'
|
argparse = require 'argparse'
|
||||||
import sort, concat from table
|
import sort, concat from table
|
||||||
import exit from os
|
import exit from os
|
||||||
|
|
||||||
-- parse the arguments
|
-- parse the arguments
|
||||||
argparse = require 'argparse'
|
|
||||||
parser = with argparse "moonbuild", "A build system in moonscript"
|
parser = with argparse "moonbuild", "A build system in moonscript"
|
||||||
\option '-b --buildfile', "Build file to use", 'Build.moon'
|
\option '-b --buildfile', "Build file to use", 'Build.moon'
|
||||||
\option '-j --parallel', "Sets the number of parallel tasks, 'y' to run as many as we have cores", '1'
|
\option '-j --parallel', "Sets the number of parallel tasks, 'y' to run as many as we have cores", '1'
|
||||||
@@ -74,15 +73,8 @@ dag = DepGraph ctx, targets
|
|||||||
print "Created dependancy graph" if args.verbose
|
print "Created dependancy graph" if args.verbose
|
||||||
|
|
||||||
-- execute the build
|
-- execute the build
|
||||||
if args.parallel==1
|
nparallel = args.parallel == 'y' and Executor\getmaxparallel! or args.parallel
|
||||||
Executor = require 'moonbuild.core.singleprocessexecutor'
|
print "Building with #{nparallel} max parallel process#{nparallel>1 and "es" or ""}" if args.verbose
|
||||||
executor = Executor dag, args.parallel
|
executor = Executor dag, nparallel
|
||||||
executor\execute args
|
executor\execute args
|
||||||
else
|
|
||||||
ok, Executor = pcall -> require 'moonbuild.core.multiprocessexecutor'
|
|
||||||
Executor = require 'moonbuild.core.singleprocessexecutor' unless ok
|
|
||||||
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
|
|
||||||
executor = Executor dag, nparallel
|
|
||||||
executor\execute args
|
|
||||||
print "Finished" if args.verbose
|
print "Finished" if args.verbose
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
-- load everything we need
|
|
||||||
import loadfile from require 'moonscript.base'
|
|
||||||
Context = require 'moonbuild.context'
|
|
||||||
DepGraph = require 'moonbuild.core.DAG'
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
moonbuild: =>
|
|
||||||
args = {
|
|
||||||
nparallel: @parallel or @j
|
|
||||||
quiet: @quiet or @q
|
|
||||||
buildfile: @buildfile or @b
|
|
||||||
force: @force or @f
|
|
||||||
}
|
|
||||||
ctx = Context!
|
|
||||||
ctx\load (loadfile args.buildfile or 'Build.moon'), @
|
|
||||||
ctx\init!
|
|
||||||
dag = DepGraph ctx, #@ == 0 and ctx.defaulttargets or @
|
|
||||||
executor = do
|
|
||||||
Executor = do
|
|
||||||
ok, Executor = pcall -> require 'moonbuild.core.multiprocessexecutor'
|
|
||||||
ok and Executor or require 'moonbuild.core.singleprocessexecutor'
|
|
||||||
args.nparallel = Executor\getmaxparallel! if args.nparallel == true
|
|
||||||
Executor dag, args.nparallel
|
|
||||||
executor\execute args
|
|
||||||
+21
-2
@@ -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,5 +18,23 @@ 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] = (...) ->
|
||||||
|
cli = cmdline ...
|
||||||
|
verbose -> print "[#{f}] #{cli}"
|
||||||
|
orig ...
|
||||||
|
_sh = cmd.sh
|
||||||
|
cmd.sh = (cli) ->
|
||||||
|
verbose -> print "[sh] #{cli}"
|
||||||
|
_sh cli
|
||||||
|
|
||||||
|
-- derived cmd functions
|
||||||
|
_cmd = cmd.cmd
|
||||||
|
_cmdrst = cmd.cmdrst
|
||||||
|
cmd.cmdline = (cmdline) -> _cmd parseargs cmdline
|
||||||
|
cmd.cmdlinerst = (cmdline) -> _cmdrst parseargs cmdline
|
||||||
|
|
||||||
-- the library itself
|
-- the library itself
|
||||||
setmetatable cmd, __call: => {'cmd', 'cmdrst', 'sh'}
|
setmetatable cmd, __call: => {'cmd', 'cmdrst', 'cmdline', 'cmdlinerst', 'sh'}
|
||||||
|
|||||||
@@ -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,17 @@ 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
|
||||||
|
else
|
||||||
|
error "_.verbose takes either no argument, a boolean or a function"
|
||||||
|
|
||||||
common.flatten = flatten
|
common.flatten = flatten
|
||||||
common.first = first
|
common.first = first
|
||||||
common.foreach = foreach
|
common.foreach = foreach
|
||||||
@@ -155,8 +166,10 @@ common.includes = includes
|
|||||||
common.patget = patget
|
common.patget = patget
|
||||||
common.patset = patset
|
common.patset = patset
|
||||||
common.patsubst = patsubst
|
common.patsubst = patsubst
|
||||||
|
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]
|
||||||
|
|||||||
+9
-3
@@ -166,10 +166,16 @@ mkdir = (dir) ->
|
|||||||
clearentry parent dir
|
clearentry parent dir
|
||||||
|
|
||||||
mkdirs = (dir) ->
|
mkdirs = (dir) ->
|
||||||
return if isdir dir
|
if attr = attributes normalizepath dir
|
||||||
error "Can't mkdirs #{dir}: file exists" if exists dir
|
return if attr.mode == 'directory'
|
||||||
|
error "Can't mkdirs #{dir}: file exists"
|
||||||
mkdirs parent dir
|
mkdirs parent dir
|
||||||
mkdir dir
|
unless pcall -> actualmkdir dir
|
||||||
|
clearentry parent dir
|
||||||
|
clearentry dir
|
||||||
|
error "Failed to mkdirs #{dir}: last mkdir failed" unless isdir dir
|
||||||
|
clearentry parent dir
|
||||||
|
clearentry dir
|
||||||
|
|
||||||
-- from the backend
|
-- from the backend
|
||||||
fs = {k, withcache fn for k, fn in pairs fs}
|
fs = {k, withcache fn for k, fn in pairs fs}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
@@ -14,8 +15,8 @@ _cdeps = (cc, cflags, path) ->
|
|||||||
rawlist = gsub (match raw, ':(.+)'), '\\\n', ' '
|
rawlist = gsub (match raw, ':(.+)'), '\\\n', ' '
|
||||||
[v for v in gmatch rawlist, '%S+']
|
[v for v in gmatch rawlist, '%S+']
|
||||||
cdeps = setmetatable {},
|
cdeps = setmetatable {},
|
||||||
__index: (cc) => (cflags, path) -> _cdeps cc, cflags, path
|
__index: (cc) => (path, cflags) -> _cdeps cc, cflags, path
|
||||||
__call: (cflags, path) => _cdeps 'cc', cflags, path
|
__call: (path, cflags) => _cdeps 'cc', cflags, path
|
||||||
|
|
||||||
readfile = (filename) ->
|
readfile = (filename) ->
|
||||||
fd, err = open filename, 'rb'
|
fd, err = open filename, 'rb'
|
||||||
@@ -34,6 +35,7 @@ writefile = (filename, data) ->
|
|||||||
nil
|
nil
|
||||||
|
|
||||||
moonc = (infile, outfile) ->
|
moonc = (infile, outfile) ->
|
||||||
|
verbose -> print "[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
|
||||||
|
|||||||
+77
-22
@@ -1,8 +1,8 @@
|
|||||||
import filter, foreach, flatten, patsubst from require 'moonbuild._common'
|
import first, filter, foreach, flatten, patsubst, includes from require 'moonbuild._common'
|
||||||
import runwithcontext from require 'moonbuild.compat.ctx'
|
import runwithcontext from require 'moonbuild.compat.ctx'
|
||||||
globalenv = require 'moonbuild.env.global'
|
globalenv = require 'moonbuild.env.global'
|
||||||
import exists, parent, mkdirs, clearentry, disableentry, attributes from require 'moonbuild._fs'
|
import exists, parent, mkdirs, clearentry, disableentry, attributes from require 'moonbuild._fs'
|
||||||
import sort from table
|
import sort, insert, remove from table
|
||||||
import huge from math
|
import huge from math
|
||||||
|
|
||||||
local DepNode, FileTarget
|
local DepNode, FileTarget
|
||||||
@@ -12,6 +12,8 @@ nodepriority = (a, b) ->
|
|||||||
tb = type b.name
|
tb = type b.name
|
||||||
da = #a.deps
|
da = #a.deps
|
||||||
db = #b.deps
|
db = #b.deps
|
||||||
|
sa = a.sync
|
||||||
|
sb = b.sync
|
||||||
if ta=='string' and tb!='string'
|
if ta=='string' and tb!='string'
|
||||||
return true
|
return true
|
||||||
elseif ta!='string' and tb=='string'
|
elseif ta!='string' and tb=='string'
|
||||||
@@ -20,6 +22,10 @@ nodepriority = (a, b) ->
|
|||||||
return true
|
return true
|
||||||
elseif a.priority < b.priority
|
elseif a.priority < b.priority
|
||||||
return false
|
return false
|
||||||
|
elseif sa and not sb
|
||||||
|
return false
|
||||||
|
elseif sb and not sa
|
||||||
|
return true
|
||||||
else
|
else
|
||||||
return da < db
|
return da < db
|
||||||
|
|
||||||
@@ -28,6 +34,7 @@ transclosure = (obj, prop) ->
|
|||||||
i = 1
|
i = 1
|
||||||
set = {}
|
set = {}
|
||||||
imp = (e) ->
|
imp = (e) ->
|
||||||
|
return unless e[prop]
|
||||||
for v in *e[prop]
|
for v in *e[prop]
|
||||||
if not set[v]
|
if not set[v]
|
||||||
elems[i], i = v, i+1
|
elems[i], i = v, i+1
|
||||||
@@ -49,28 +56,64 @@ class DepGraph
|
|||||||
|
|
||||||
addnode: (name) =>
|
addnode: (name) =>
|
||||||
return if @nodes[name]
|
return if @nodes[name]
|
||||||
elected = @resolvedeps name
|
elected = @topresolvedeps name
|
||||||
@nodes[name] = elected
|
@nodes[name] = elected
|
||||||
for dep in *(transclosure elected, 'deps')
|
for dep in *(transclosure elected, 'deps')
|
||||||
@nodes[dep.name] = dep
|
@nodes[dep.name] = dep
|
||||||
dep.deps = nil
|
dep.deps = nil
|
||||||
elected.deps = nil
|
elected.deps = nil
|
||||||
|
|
||||||
resolvedeps: (name) =>
|
topresolvedeps: (name) =>
|
||||||
|
errors = {}
|
||||||
|
ok, rst = pcall -> @resolvedeps name, nil, errors
|
||||||
|
if ok
|
||||||
|
rst
|
||||||
|
else
|
||||||
|
msg = {"Failed to resolve target \'#{name}\'\n"}
|
||||||
|
for e in *errors
|
||||||
|
if e.err\match '^moonbuild'
|
||||||
|
e.err = e.err\match ': (.+)$'
|
||||||
|
for i=#errors, 1, -1
|
||||||
|
e = errors[i]
|
||||||
|
insert msg, "#{string.rep '| ', e.level - 1}+-[#{e.name}] level #{e.level}: #{e.err}"
|
||||||
|
insert msg, ''
|
||||||
|
error table.concat msg, '\n'
|
||||||
|
|
||||||
|
resolvedeps: (name, level=1, errors={}) =>
|
||||||
do
|
do
|
||||||
node = @nodes[name]
|
node = @nodes[name]
|
||||||
return node, {} if node
|
if node
|
||||||
|
print "deps(#{name}) = #{node.name or '[noname]'}"
|
||||||
|
return node, {}
|
||||||
candidates = filter {@ctx.targets, FileTarget!}, (target) -> target\matches name
|
candidates = filter {@ctx.targets, FileTarget!}, (target) -> target\matches name
|
||||||
nodes = foreach candidates, (candidate) -> a: {pcall -> DepNode @, candidate, name}
|
nodes = foreach candidates, (candidate) -> a: {pcall -> DepNode @, candidate, name, level, errors}
|
||||||
resolved = foreach (filter nodes, (node) -> node.a[1]), (node) -> node.a[2]
|
resolved = foreach (filter nodes, (node) -> node.a[1]), (node) -> node.a[2]
|
||||||
sort resolved, nodepriority
|
sort resolved, nodepriority
|
||||||
resolved[1] or error "Cannot resolve target #{name}"
|
unless resolved[1]
|
||||||
|
err = "Cannot resolve target #{name}: #{#candidates} candidates, #{#resolved} resolved"
|
||||||
|
table.insert errors, {:name, :level, :err}
|
||||||
|
error err
|
||||||
|
resolved[1]
|
||||||
|
|
||||||
buildablenodes: =>
|
buildablenodes: =>
|
||||||
[v for k, v in pairs @nodes when v\canbuild! and not v.built]
|
[v for k, v in pairs @nodes when v\canbuild! and not v.built]
|
||||||
|
|
||||||
|
reset: =>
|
||||||
|
n.built = false for k, n in pairs @nodes
|
||||||
|
|
||||||
|
resetchildren: (names) =>
|
||||||
|
done = {}
|
||||||
|
stack = [v for v in *names]
|
||||||
|
while #stack != 0
|
||||||
|
name = remove stack
|
||||||
|
continue if done[name]
|
||||||
|
done[name] = true
|
||||||
|
node = @nodes[name]
|
||||||
|
node.built = false
|
||||||
|
insert stack, n for n in *(node\children!)
|
||||||
|
|
||||||
class DepNode
|
class DepNode
|
||||||
new: (@dag, target, @name) =>
|
new: (@dag, target, @name, @level, errors) =>
|
||||||
@priority = target.priority
|
@priority = target.priority
|
||||||
@buildfunctions = target.buildfunctions
|
@buildfunctions = target.buildfunctions
|
||||||
@mkdirs = target._mkdirs
|
@mkdirs = target._mkdirs
|
||||||
@@ -80,45 +123,57 @@ class DepNode
|
|||||||
@type = 'virtual' if #@outs == 0
|
@type = 'virtual' if #@outs == 0
|
||||||
@built = false
|
@built = false
|
||||||
|
|
||||||
resolve = (name) -> @dag\resolvedeps patsubst @name, target.pattern, name
|
resolve = (name) -> @dag\resolvedeps (patsubst @name, target.pattern, name), level + 1, errors
|
||||||
after = flatten foreach target.needtargets, resolve
|
after = flatten foreach target.needtargets, resolve
|
||||||
deps = flatten foreach target.infiles, resolve
|
deps = flatten foreach target.infiles, resolve
|
||||||
if #target.depfunctions!=0
|
if #target.depfunctions!=0
|
||||||
ctx = setmetatable {},
|
ctx = setmetatable {},
|
||||||
__index: (_, k) ->
|
__index: (_, k) ->
|
||||||
switch k
|
switch k
|
||||||
when 'infile' then first deps
|
when 'infile', 'in'
|
||||||
when 'infiles' then flatten deps
|
f = first deps
|
||||||
when 'outfile' then first @outs
|
f and f.name
|
||||||
when 'outfiles' then flatten @outs
|
when 'infiles'
|
||||||
when 'name' then @name
|
foreach deps, => @name
|
||||||
else error "No such field in TargetDepsContext: #{k}"
|
when 'outfile', 'out'
|
||||||
|
f = first @outs
|
||||||
|
f and f.name
|
||||||
|
when 'outfiles'
|
||||||
|
foreach @outs, => @name
|
||||||
|
when 'name'
|
||||||
|
@name
|
||||||
|
else
|
||||||
|
error "No such field in TargetDepsContext: #{k}"
|
||||||
__newindex: (k) =>
|
__newindex: (k) =>
|
||||||
error "Attempt to set field #{k} of TargetDepsContext"
|
error "Attempt to set field #{k} of TargetDepsContext"
|
||||||
for depfn in *target.depfunctions
|
for depfn in *target.depfunctions
|
||||||
deps = flatten deps, foreach depfn, (fn) -> resolve runwithcontext fn, @dag.env, ctx
|
deps = flatten deps, foreach (runwithcontext depfn, @dag.env, ctx), resolve
|
||||||
@ins = foreach deps, (dep) -> dep.name
|
@ins = foreach deps, (dep) -> dep.name
|
||||||
@after = foreach after, (dep) -> dep.name
|
@after = foreach after, (dep) -> dep.name
|
||||||
@deps = flatten { deps, after }
|
@deps = flatten { deps, after }
|
||||||
@built = true if #@deps == 0 and #@buildfunctions == 0
|
@built = true if #@deps == 0 and #@buildfunctions == 0
|
||||||
|
|
||||||
|
children: =>
|
||||||
|
[k for k, n in pairs @dag.nodes when (includes n.ins, @name) or (includes n.after, @name)]
|
||||||
|
|
||||||
canbuild: =>
|
canbuild: =>
|
||||||
for node in *flatten { @ins, @after }
|
for node in *flatten { @ins, @after }
|
||||||
if not @dag.nodes[node].built
|
if not @dag.nodes[node].built
|
||||||
return false
|
return false
|
||||||
for file in *@ins
|
for file in *@ins
|
||||||
if not exists file
|
if not exists file
|
||||||
error "Node #{name} has ran all of its parents, but can't run since #{file} doesn't exist"
|
error "Node #{@name} has ran all of its parents, but can't run since #{file} doesn't exist. Did you mean to use after instead of depends?"
|
||||||
return true
|
return true
|
||||||
|
|
||||||
build: (opts={}) =>
|
build: (opts={}) =>
|
||||||
force = opts.force or false
|
force = opts.force or false
|
||||||
quiet = opts.quiet or false
|
quiet = opts.quiet or false
|
||||||
|
|
||||||
return if @built
|
return false if @built or #@buildfunctions == 0
|
||||||
return unless force or @shouldbuild!
|
return false unless force or @shouldbuild!
|
||||||
print "#{@type == 'virtual' and "Running" or "Building"} #{@name}" unless quiet or #@buildfunctions == 0
|
print "#{@type == 'virtual' and "Running" or "Building"} #{@name} [level #{@level}]" unless quiet
|
||||||
@actuallybuild!
|
@actuallybuild!
|
||||||
|
true
|
||||||
|
|
||||||
|
|
||||||
shouldbuild: =>
|
shouldbuild: =>
|
||||||
@@ -149,9 +204,9 @@ class DepNode
|
|||||||
ctx = setmetatable {},
|
ctx = setmetatable {},
|
||||||
__index: (_, k) ->
|
__index: (_, k) ->
|
||||||
switch k
|
switch k
|
||||||
when 'infile' then @ins[1]
|
when 'infile', 'in' then @ins[1]
|
||||||
when 'infiles' then @ins
|
when 'infiles' then @ins
|
||||||
when 'outfile' then @outs[1]
|
when 'outfile', 'out' then @outs[1]
|
||||||
when 'outfiles' then @outs
|
when 'outfiles' then @outs
|
||||||
when 'name' then @name
|
when 'name' then @name
|
||||||
else error "No such field in TargetContext: #{k}"
|
else error "No such field in TargetContext: #{k}"
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
Target = require 'moonbuild.core.Target'
|
||||||
|
_ = require 'moonbuild._'
|
||||||
|
import flatten, patsubst from _
|
||||||
|
|
||||||
|
class Pipeline
|
||||||
|
new: (@ctx) =>
|
||||||
|
@lastsources = {}
|
||||||
|
|
||||||
|
sources: (...) =>
|
||||||
|
@lastsources = flatten @lastsources, ...
|
||||||
|
source: (src) =>
|
||||||
|
@lastsources = flatten @lastsources, src
|
||||||
|
|
||||||
|
step: (name, params) =>
|
||||||
|
public = true
|
||||||
|
public, params = false, name if (type name) == 'table'
|
||||||
|
|
||||||
|
tgttype = if params.pattern
|
||||||
|
error "pattern must be a table with the same format as patsubst" unless (type params.pattern) == 'table' and (type params.pattern[1]) == 'string' and (type params.pattern[2]) == 'string'
|
||||||
|
'pattern'
|
||||||
|
elseif params.output or params.out
|
||||||
|
error "output must be a string" unless (type params.output or params.out) == 'string'
|
||||||
|
'single'
|
||||||
|
else
|
||||||
|
error "invalid step type for pipeline: must be pattern or single (out/output)"
|
||||||
|
|
||||||
|
tgtouts = switch tgttype
|
||||||
|
when 'pattern' then patsubst @lastsources, params.pattern[1], params.pattern[2]
|
||||||
|
when 'single' then params.output or params.out
|
||||||
|
|
||||||
|
tgtpatt = switch tgttype
|
||||||
|
when 'pattern' then params.pattern[2]
|
||||||
|
when 'single' then nil
|
||||||
|
|
||||||
|
tgtins = switch tgttype
|
||||||
|
when 'pattern' then params.pattern[1]
|
||||||
|
when 'single' then @lastsources
|
||||||
|
|
||||||
|
tgtprod = switch tgttype
|
||||||
|
when 'pattern' then params.pattern[2]
|
||||||
|
when 'single' then '%'
|
||||||
|
|
||||||
|
tgt = with Target @ctx, tgtouts, pattern: tgtpatt
|
||||||
|
\depends tgtins
|
||||||
|
\produces tgtprod
|
||||||
|
\fn params.fn or error "pipeline steps need a fn"
|
||||||
|
tgt\mkdirs! if params.mkdirs
|
||||||
|
tgt\sync! if params.sync
|
||||||
|
@ctx\addtarget tgt
|
||||||
|
|
||||||
|
if public
|
||||||
|
@ctx\addtarget with Target @ctx, name
|
||||||
|
\depends tgtouts
|
||||||
|
.public = true
|
||||||
|
|
||||||
|
@lastsources = tgtouts
|
||||||
@@ -4,7 +4,17 @@ class Variable
|
|||||||
|
|
||||||
new: (@name, ...) =>
|
new: (@name, ...) =>
|
||||||
@public = false
|
@public = false
|
||||||
if (select '#', ...) !=1 or (type ...) == 'table'
|
if (type @name) == 'table'
|
||||||
|
error "not a valid var table: #{next @name}" unless (type next @name) == 'string'
|
||||||
|
error "more than one var at once: #{next @name}, #{next @name, (next @name)}" if next @name, (next @name)
|
||||||
|
name = next @name
|
||||||
|
@name, param = name, @name
|
||||||
|
val = param[name]
|
||||||
|
if (select '#', ...) !=0 or (type val) == 'table'
|
||||||
|
@value = flatten val, ...
|
||||||
|
else
|
||||||
|
@value = val
|
||||||
|
elseif (select '#', ...) !=1 or (type ...) == 'table'
|
||||||
@value = flatten ...
|
@value = flatten ...
|
||||||
else
|
else
|
||||||
@value = ...
|
@value = ...
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
ok, MultiProcessExecutor = pcall -> require 'moonbuild.core.multiprocessexecutor'
|
||||||
|
ok and MultiProcessExecutor or require 'moonbuild.core.singleprocessexecutor'
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
SingleProcessExecutor = require 'moonbuild.core.singleprocessexecutor'
|
||||||
import fork, _exit from require 'posix.unistd'
|
import fork, _exit from require 'posix.unistd'
|
||||||
import wait from require 'posix.sys.wait'
|
import wait from require 'posix.sys.wait'
|
||||||
import open, stderr from io
|
import open, stderr from io
|
||||||
@@ -17,8 +18,12 @@ class Executor
|
|||||||
@processes = {}
|
@processes = {}
|
||||||
@nprocesses = 0
|
@nprocesses = 0
|
||||||
@building = {}
|
@building = {}
|
||||||
|
@nbuilt = 0
|
||||||
|
|
||||||
execute: (opts) =>
|
execute: (opts) =>
|
||||||
|
if @nparallel == 1
|
||||||
|
return (SingleProcessExecutor @dag, 1)\execute opts
|
||||||
|
|
||||||
block = @dag\buildablenodes!
|
block = @dag\buildablenodes!
|
||||||
while #block != 0
|
while #block != 0
|
||||||
for node in *block
|
for node in *block
|
||||||
@@ -36,7 +41,21 @@ class Executor
|
|||||||
for name, node in pairs @dag.nodes
|
for name, node in pairs @dag.nodes
|
||||||
error "Node #{name} wasn't built" unless node.built
|
error "Node #{name} wasn't built" unless node.built
|
||||||
|
|
||||||
|
unless opts.quiet
|
||||||
|
if @nbuilt == 0
|
||||||
|
print "Nothing to be done"
|
||||||
|
else
|
||||||
|
print "Built #{@nbuilt} targets"
|
||||||
|
|
||||||
addprocess: (node, opts) =>
|
addprocess: (node, opts) =>
|
||||||
|
if node.sync
|
||||||
|
while @nprocesses != 0
|
||||||
|
@waitprocess!
|
||||||
|
node\build opts
|
||||||
|
node.built = true
|
||||||
|
node\updatecache!
|
||||||
|
return
|
||||||
|
|
||||||
pid = fork!
|
pid = fork!
|
||||||
error "Failed to fork" unless pid
|
error "Failed to fork" unless pid
|
||||||
if pid!=0
|
if pid!=0
|
||||||
@@ -44,18 +63,20 @@ class Executor
|
|||||||
@nprocesses += 1
|
@nprocesses += 1
|
||||||
@building[node] = true
|
@building[node] = true
|
||||||
else
|
else
|
||||||
ok, err = pcall -> node\build opts
|
ok, status = pcall -> node\build opts
|
||||||
if ok
|
if ok
|
||||||
|
_exit status and 0 or 2
|
||||||
_exit 0
|
_exit 0
|
||||||
else
|
else
|
||||||
stderr\write err
|
stderr\write status
|
||||||
_exit 1
|
_exit 1
|
||||||
|
|
||||||
waitprocess: =>
|
waitprocess: =>
|
||||||
pid, ty, status = wait!
|
pid, ty, status = wait!
|
||||||
error "Failed to wait" unless pid
|
error "Failed to wait" unless pid
|
||||||
error "Failed to build #{@processes[pid].name}" if ty != 'exited' or status != 0
|
error "Failed to build #{@processes[pid].name}" if ty != 'exited' or status != 0 and status != 2
|
||||||
@processes[pid].built = true
|
@processes[pid].built = true
|
||||||
@processes[pid]\updatecache!
|
@processes[pid]\updatecache!
|
||||||
@processes[pid] = nil
|
@processes[pid] = nil
|
||||||
@nprocesses -= 1
|
@nprocesses -= 1
|
||||||
|
@nbuilt += 1 if status == 0
|
||||||
|
|||||||
@@ -4,13 +4,21 @@ class Executor
|
|||||||
new: (@dag, @nparallel) =>
|
new: (@dag, @nparallel) =>
|
||||||
|
|
||||||
execute: (opts) =>
|
execute: (opts) =>
|
||||||
|
nbuilt = 0
|
||||||
|
|
||||||
block = @dag\buildablenodes!
|
block = @dag\buildablenodes!
|
||||||
while #block != 0
|
while #block != 0
|
||||||
for node in *block
|
for node in *block
|
||||||
node\build opts
|
nbuilt +=1 if node\build opts
|
||||||
node\updatecache!
|
node\updatecache!
|
||||||
node.built = true
|
node.built = true
|
||||||
block = @dag\buildablenodes!
|
block = @dag\buildablenodes!
|
||||||
|
|
||||||
for name, node in pairs @dag.nodes
|
for name, node in pairs @dag.nodes
|
||||||
error "Node #{name} wasn't built" unless node.built
|
error "Node #{name} wasn't built" unless node.built
|
||||||
|
|
||||||
|
unless opts.quiet
|
||||||
|
if nbuilt == 0
|
||||||
|
print "Nothing to be done"
|
||||||
|
else
|
||||||
|
print "Built #{nbuilt} targets"
|
||||||
|
|||||||
Vendored
+7
-3
@@ -1,5 +1,6 @@
|
|||||||
Target = require 'moonbuild.core.Target'
|
Target = require 'moonbuild.core.Target'
|
||||||
Variable = require 'moonbuild.core.Variable'
|
Variable = require 'moonbuild.core.Variable'
|
||||||
|
Pipeline = require 'moonbuild.core.Pipeline'
|
||||||
_ = require 'moonbuild._'
|
_ = require 'moonbuild._'
|
||||||
import flatten from _
|
import flatten from _
|
||||||
|
|
||||||
@@ -18,10 +19,10 @@ import flatten from _
|
|||||||
rawset env, '_G', env
|
rawset env, '_G', env
|
||||||
rawset env, '_ENV', env
|
rawset env, '_ENV', env
|
||||||
|
|
||||||
rawset env, 'var', (name, ...) ->
|
rawset env, 'var', (...) ->
|
||||||
var = Variable name, ...
|
var = Variable ...
|
||||||
ctx\addvar var
|
ctx\addvar var
|
||||||
rawset varlayer, name, var.value
|
rawset varlayer, var.name, var.value
|
||||||
var
|
var
|
||||||
|
|
||||||
rawset env, 'target', (name, opts) ->
|
rawset env, 'target', (name, opts) ->
|
||||||
@@ -29,4 +30,7 @@ import flatten from _
|
|||||||
ctx\addtarget target
|
ctx\addtarget target
|
||||||
target
|
target
|
||||||
|
|
||||||
|
rawset env, 'pipeline', ->
|
||||||
|
Pipeline ctx
|
||||||
|
|
||||||
env, varlayer
|
env, varlayer
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
import loadfile from require 'moonscript.base'
|
||||||
|
Context = require 'moonbuild.context'
|
||||||
|
DepGraph = require 'moonbuild.core.DAG'
|
||||||
|
Executor = require 'moonbuild.core.executor'
|
||||||
|
_ = require 'moonbuild._'
|
||||||
|
import insert from table
|
||||||
|
|
||||||
|
moonbuild = (...) ->
|
||||||
|
-- build argument table
|
||||||
|
opts = {}
|
||||||
|
for i=1, select '#', ...
|
||||||
|
arg = select i, ...
|
||||||
|
if (type arg) == 'string'
|
||||||
|
insert opts, arg
|
||||||
|
elseif (type arg) == 'table'
|
||||||
|
for k, v in pairs arg
|
||||||
|
opts[k] = v if (type k) != 'number'
|
||||||
|
for i, v in ipairs arg
|
||||||
|
insert opts, v
|
||||||
|
else
|
||||||
|
error "Invalid argument type #{type arg} for moonbuild"
|
||||||
|
|
||||||
|
-- resolve arguments
|
||||||
|
buildfile = opts.buildfile or opts.b or 'Build.moon'
|
||||||
|
opts.buildfile = buildfile
|
||||||
|
parallel = opts.parallel or opts.j or 1
|
||||||
|
parallel = true if parallel == 'y'
|
||||||
|
opts.parallel = parallel
|
||||||
|
quiet = opts.quiet or opts.q or false
|
||||||
|
opts.quiet = quiet
|
||||||
|
force = opts.force or opts.f or false
|
||||||
|
opts.force = force
|
||||||
|
verbose = opts.verbose or opts.v or false
|
||||||
|
opts.verbose = verbose
|
||||||
|
|
||||||
|
-- set verbosity level
|
||||||
|
_.verbose verbose
|
||||||
|
|
||||||
|
-- create context and DAG
|
||||||
|
ctx = Context!
|
||||||
|
ctx\load (loadfile buildfile), opts
|
||||||
|
_.verbose -> print "Loaded buildfile"
|
||||||
|
ctx\init!
|
||||||
|
_.verbose -> print "Initialized buildfile"
|
||||||
|
targets = #opts==0 and ctx.defaulttargets or opts
|
||||||
|
dag = DepGraph ctx, targets
|
||||||
|
_.verbose -> print "Created dependancy graph"
|
||||||
|
|
||||||
|
-- and build
|
||||||
|
nparallel = parallel == true and Executor\getmaxparallel! or parallel
|
||||||
|
_.verbose -> print "Building with #{nparallel} max parallel process#{nparallel>1 and "es" or ""}"
|
||||||
|
executor = Executor dag, nparallel
|
||||||
|
executor\execute opts
|
||||||
|
_.verbose -> print "Finished"
|
||||||
|
|
||||||
|
print _.verbose!
|
||||||
|
|
||||||
|
table = {
|
||||||
|
:moonbuild, :_
|
||||||
|
:Context, :DepGraph, :Executor
|
||||||
|
}
|
||||||
|
|
||||||
|
setmetatable table,
|
||||||
|
__call: (...) => moonbuild ...
|
||||||
|
__index: (name) => require "moonbuild.#{name}"
|
||||||
Generated
+13
-2501
File diff suppressed because it is too large
Load Diff
+512
-107
@@ -1,6 +1,3 @@
|
|||||||
#!/usr/bin/env lua5.3
|
|
||||||
do
|
|
||||||
|
|
||||||
do
|
do
|
||||||
local _ENV = _ENV
|
local _ENV = _ENV
|
||||||
package.preload[ "moonbuild._" ] = function( ... ) local arg = _G.arg;
|
package.preload[ "moonbuild._" ] = function( ... ) local arg = _G.arg;
|
||||||
@@ -39,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()
|
||||||
@@ -70,11 +69,43 @@ 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(...)
|
||||||
|
local cli = cmdline(...)
|
||||||
|
verbose(function()
|
||||||
|
return print("[" .. tostring(f) .. "] " .. tostring(cli))
|
||||||
|
end)
|
||||||
|
return orig(...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local _sh = cmd.sh
|
||||||
|
cmd.sh = function(cli)
|
||||||
|
verbose(function()
|
||||||
|
return print("[sh] " .. tostring(cli))
|
||||||
|
end)
|
||||||
|
return _sh(cli)
|
||||||
|
end
|
||||||
|
local _cmd = cmd.cmd
|
||||||
|
local _cmdrst = cmd.cmdrst
|
||||||
|
cmd.cmdline = function(cmdline)
|
||||||
|
return _cmd(parseargs(cmdline))
|
||||||
|
end
|
||||||
|
cmd.cmdlinerst = function(cmdline)
|
||||||
|
return _cmdrst(parseargs(cmdline))
|
||||||
|
end
|
||||||
return setmetatable(cmd, {
|
return setmetatable(cmd, {
|
||||||
__call = function(self)
|
__call = function(self)
|
||||||
return {
|
return {
|
||||||
'cmd',
|
'cmd',
|
||||||
'cmdrst',
|
'cmdrst',
|
||||||
|
'cmdline',
|
||||||
|
'cmdlinerst',
|
||||||
'sh'
|
'sh'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@@ -92,6 +123,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 = {
|
||||||
['\"'] = '\\\"',
|
['\"'] = '\\\"',
|
||||||
['\\'] = '\\\\',
|
['\\'] = '\\\\',
|
||||||
@@ -223,26 +256,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(...)
|
||||||
@@ -257,6 +270,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(...))
|
||||||
@@ -276,6 +310,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) .. ")")
|
||||||
@@ -347,6 +384,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 {
|
||||||
@@ -628,6 +668,21 @@ 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
|
||||||
|
else
|
||||||
|
return error("_.verbose takes either no argument, a boolean or a function")
|
||||||
|
end
|
||||||
|
end
|
||||||
common.flatten = flatten
|
common.flatten = flatten
|
||||||
common.first = first
|
common.first = first
|
||||||
common.foreach = foreach
|
common.foreach = foreach
|
||||||
@@ -636,9 +691,11 @@ common.includes = includes
|
|||||||
common.patget = patget
|
common.patget = patget
|
||||||
common.patset = patset
|
common.patset = patset
|
||||||
common.patsubst = patsubst
|
common.patsubst = patsubst
|
||||||
|
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 = { }
|
||||||
@@ -963,14 +1020,27 @@ mkdir = function(dir)
|
|||||||
end
|
end
|
||||||
local mkdirs
|
local mkdirs
|
||||||
mkdirs = function(dir)
|
mkdirs = function(dir)
|
||||||
if isdir(dir) then
|
do
|
||||||
return
|
local attr = attributes(normalizepath(dir))
|
||||||
end
|
if attr then
|
||||||
if exists(dir) then
|
if attr.mode == 'directory' then
|
||||||
error("Can't mkdirs " .. tostring(dir) .. ": file exists")
|
return
|
||||||
|
end
|
||||||
|
error("Can't mkdirs " .. tostring(dir) .. ": file exists")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
mkdirs(parent(dir))
|
mkdirs(parent(dir))
|
||||||
return mkdir(dir)
|
if not (pcall(function()
|
||||||
|
return actualmkdir(dir)
|
||||||
|
end)) then
|
||||||
|
clearentry(parent(dir))
|
||||||
|
clearentry(dir)
|
||||||
|
if not (isdir(dir)) then
|
||||||
|
error("Failed to mkdirs " .. tostring(dir) .. ": last mkdir failed")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
clearentry(parent(dir))
|
||||||
|
return clearentry(dir)
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local _tbl_0 = { }
|
local _tbl_0 = { }
|
||||||
@@ -1239,6 +1309,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
|
||||||
@@ -1272,11 +1344,11 @@ _cdeps = function(cc, cflags, path)
|
|||||||
end
|
end
|
||||||
local cdeps = setmetatable({ }, {
|
local cdeps = setmetatable({ }, {
|
||||||
__index = function(self, cc)
|
__index = function(self, cc)
|
||||||
return function(cflags, path)
|
return function(path, cflags)
|
||||||
return _cdeps(cc, cflags, path)
|
return _cdeps(cc, cflags, path)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
__call = function(self, cflags, path)
|
__call = function(self, path, cflags)
|
||||||
return _cdeps('cc', cflags, path)
|
return _cdeps('cc', cflags, path)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@@ -1310,6 +1382,9 @@ writefile = function(filename, data)
|
|||||||
end
|
end
|
||||||
local moonc
|
local moonc
|
||||||
moonc = function(infile, outfile)
|
moonc = function(infile, outfile)
|
||||||
|
verbose(function()
|
||||||
|
return print("[moonc] " .. tostring(infile) .. " " .. tostring(outfile))
|
||||||
|
end)
|
||||||
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))
|
||||||
@@ -1646,10 +1721,10 @@ end
|
|||||||
do
|
do
|
||||||
local _ENV = _ENV
|
local _ENV = _ENV
|
||||||
package.preload[ "moonbuild.core.DAG" ] = function( ... ) local arg = _G.arg;
|
package.preload[ "moonbuild.core.DAG" ] = function( ... ) local arg = _G.arg;
|
||||||
local filter, foreach, flatten, patsubst
|
local first, filter, foreach, flatten, patsubst, includes
|
||||||
do
|
do
|
||||||
local _obj_0 = require('moonbuild._common')
|
local _obj_0 = require('moonbuild._common')
|
||||||
filter, foreach, flatten, patsubst = _obj_0.filter, _obj_0.foreach, _obj_0.flatten, _obj_0.patsubst
|
first, filter, foreach, flatten, patsubst, includes = _obj_0.first, _obj_0.filter, _obj_0.foreach, _obj_0.flatten, _obj_0.patsubst, _obj_0.includes
|
||||||
end
|
end
|
||||||
local runwithcontext
|
local runwithcontext
|
||||||
runwithcontext = require('moonbuild.compat.ctx').runwithcontext
|
runwithcontext = require('moonbuild.compat.ctx').runwithcontext
|
||||||
@@ -1659,8 +1734,11 @@ do
|
|||||||
local _obj_0 = require('moonbuild._fs')
|
local _obj_0 = require('moonbuild._fs')
|
||||||
exists, parent, mkdirs, clearentry, disableentry, attributes = _obj_0.exists, _obj_0.parent, _obj_0.mkdirs, _obj_0.clearentry, _obj_0.disableentry, _obj_0.attributes
|
exists, parent, mkdirs, clearentry, disableentry, attributes = _obj_0.exists, _obj_0.parent, _obj_0.mkdirs, _obj_0.clearentry, _obj_0.disableentry, _obj_0.attributes
|
||||||
end
|
end
|
||||||
local sort
|
local sort, insert, remove
|
||||||
sort = table.sort
|
do
|
||||||
|
local _obj_0 = table
|
||||||
|
sort, insert, remove = _obj_0.sort, _obj_0.insert, _obj_0.remove
|
||||||
|
end
|
||||||
local huge
|
local huge
|
||||||
huge = math.huge
|
huge = math.huge
|
||||||
local DepNode, FileTarget
|
local DepNode, FileTarget
|
||||||
@@ -1670,6 +1748,8 @@ nodepriority = function(a, b)
|
|||||||
local tb = type(b.name)
|
local tb = type(b.name)
|
||||||
local da = #a.deps
|
local da = #a.deps
|
||||||
local db = #b.deps
|
local db = #b.deps
|
||||||
|
local sa = a.sync
|
||||||
|
local sb = b.sync
|
||||||
if ta == 'string' and tb ~= 'string' then
|
if ta == 'string' and tb ~= 'string' then
|
||||||
return true
|
return true
|
||||||
elseif ta ~= 'string' and tb == 'string' then
|
elseif ta ~= 'string' and tb == 'string' then
|
||||||
@@ -1678,6 +1758,10 @@ nodepriority = function(a, b)
|
|||||||
return true
|
return true
|
||||||
elseif a.priority < b.priority then
|
elseif a.priority < b.priority then
|
||||||
return false
|
return false
|
||||||
|
elseif sa and not sb then
|
||||||
|
return false
|
||||||
|
elseif sb and not sa then
|
||||||
|
return true
|
||||||
else
|
else
|
||||||
return da < db
|
return da < db
|
||||||
end
|
end
|
||||||
@@ -1689,6 +1773,9 @@ transclosure = function(obj, prop)
|
|||||||
local set = { }
|
local set = { }
|
||||||
local imp
|
local imp
|
||||||
imp = function(e)
|
imp = function(e)
|
||||||
|
if not (e[prop]) then
|
||||||
|
return
|
||||||
|
end
|
||||||
local _list_0 = e[prop]
|
local _list_0 = e[prop]
|
||||||
for _index_0 = 1, #_list_0 do
|
for _index_0 = 1, #_list_0 do
|
||||||
local v = _list_0[_index_0]
|
local v = _list_0[_index_0]
|
||||||
@@ -1715,7 +1802,7 @@ do
|
|||||||
if self.nodes[name] then
|
if self.nodes[name] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local elected = self:resolvedeps(name)
|
local elected = self:topresolvedeps(name)
|
||||||
self.nodes[name] = elected
|
self.nodes[name] = elected
|
||||||
local _list_0 = (transclosure(elected, 'deps'))
|
local _list_0 = (transclosure(elected, 'deps'))
|
||||||
for _index_0 = 1, #_list_0 do
|
for _index_0 = 1, #_list_0 do
|
||||||
@@ -1725,10 +1812,42 @@ do
|
|||||||
end
|
end
|
||||||
elected.deps = nil
|
elected.deps = nil
|
||||||
end,
|
end,
|
||||||
resolvedeps = function(self, name)
|
topresolvedeps = function(self, name)
|
||||||
|
local errors = { }
|
||||||
|
local ok, rst = pcall(function()
|
||||||
|
return self:resolvedeps(name, nil, errors)
|
||||||
|
end)
|
||||||
|
if ok then
|
||||||
|
return rst
|
||||||
|
else
|
||||||
|
local msg = {
|
||||||
|
"Failed to resolve target \'" .. tostring(name) .. "\'\n"
|
||||||
|
}
|
||||||
|
for _index_0 = 1, #errors do
|
||||||
|
local e = errors[_index_0]
|
||||||
|
if e.err:match('^moonbuild') then
|
||||||
|
e.err = e.err:match(': (.+)$')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for i = #errors, 1, -1 do
|
||||||
|
local e = errors[i]
|
||||||
|
insert(msg, tostring(string.rep('| ', e.level - 1)) .. "+-[" .. tostring(e.name) .. "] level " .. tostring(e.level) .. ": " .. tostring(e.err))
|
||||||
|
end
|
||||||
|
insert(msg, '')
|
||||||
|
return error(table.concat(msg, '\n'))
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
resolvedeps = function(self, name, level, errors)
|
||||||
|
if level == nil then
|
||||||
|
level = 1
|
||||||
|
end
|
||||||
|
if errors == nil then
|
||||||
|
errors = { }
|
||||||
|
end
|
||||||
do
|
do
|
||||||
local node = self.nodes[name]
|
local node = self.nodes[name]
|
||||||
if node then
|
if node then
|
||||||
|
print("deps(" .. tostring(name) .. ") = " .. tostring(node.name or '[noname]'))
|
||||||
return node, { }
|
return node, { }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1742,7 +1861,7 @@ do
|
|||||||
return {
|
return {
|
||||||
a = {
|
a = {
|
||||||
pcall(function()
|
pcall(function()
|
||||||
return DepNode(self, candidate, name)
|
return DepNode(self, candidate, name, level, errors)
|
||||||
end)
|
end)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1753,7 +1872,16 @@ do
|
|||||||
return node.a[2]
|
return node.a[2]
|
||||||
end)
|
end)
|
||||||
sort(resolved, nodepriority)
|
sort(resolved, nodepriority)
|
||||||
return resolved[1] or error("Cannot resolve target " .. tostring(name))
|
if not (resolved[1]) then
|
||||||
|
local err = "Cannot resolve target " .. tostring(name) .. ": " .. tostring(#candidates) .. " candidates, " .. tostring(#resolved) .. " resolved"
|
||||||
|
table.insert(errors, {
|
||||||
|
name = name,
|
||||||
|
level = level,
|
||||||
|
err = err
|
||||||
|
})
|
||||||
|
error(err)
|
||||||
|
end
|
||||||
|
return resolved[1]
|
||||||
end,
|
end,
|
||||||
buildablenodes = function(self)
|
buildablenodes = function(self)
|
||||||
local _accum_0 = { }
|
local _accum_0 = { }
|
||||||
@@ -1765,6 +1893,47 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
return _accum_0
|
return _accum_0
|
||||||
|
end,
|
||||||
|
reset = function(self)
|
||||||
|
for k, n in pairs(self.nodes) do
|
||||||
|
n.built = false
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
resetchildren = function(self, names)
|
||||||
|
local done = { }
|
||||||
|
local stack
|
||||||
|
do
|
||||||
|
local _accum_0 = { }
|
||||||
|
local _len_0 = 1
|
||||||
|
for _index_0 = 1, #names do
|
||||||
|
local v = names[_index_0]
|
||||||
|
_accum_0[_len_0] = v
|
||||||
|
_len_0 = _len_0 + 1
|
||||||
|
end
|
||||||
|
stack = _accum_0
|
||||||
|
end
|
||||||
|
while #stack ~= 0 do
|
||||||
|
local _continue_0 = false
|
||||||
|
repeat
|
||||||
|
local name = remove(stack)
|
||||||
|
if done[name] then
|
||||||
|
_continue_0 = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
done[name] = true
|
||||||
|
local node = self.nodes[name]
|
||||||
|
node.built = false
|
||||||
|
local _list_0 = (node:children())
|
||||||
|
for _index_0 = 1, #_list_0 do
|
||||||
|
local n = _list_0[_index_0]
|
||||||
|
insert(stack, n)
|
||||||
|
end
|
||||||
|
_continue_0 = true
|
||||||
|
until true
|
||||||
|
if not _continue_0 then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
_base_0.__index = _base_0
|
_base_0.__index = _base_0
|
||||||
@@ -1797,6 +1966,17 @@ end
|
|||||||
do
|
do
|
||||||
local _class_0
|
local _class_0
|
||||||
local _base_0 = {
|
local _base_0 = {
|
||||||
|
children = function(self)
|
||||||
|
local _accum_0 = { }
|
||||||
|
local _len_0 = 1
|
||||||
|
for k, n in pairs(self.dag.nodes) do
|
||||||
|
if (includes(n.ins, self.name)) or (includes(n.after, self.name)) then
|
||||||
|
_accum_0[_len_0] = k
|
||||||
|
_len_0 = _len_0 + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return _accum_0
|
||||||
|
end,
|
||||||
canbuild = function(self)
|
canbuild = function(self)
|
||||||
local _list_0 = flatten({
|
local _list_0 = flatten({
|
||||||
self.ins,
|
self.ins,
|
||||||
@@ -1812,7 +1992,7 @@ do
|
|||||||
for _index_0 = 1, #_list_1 do
|
for _index_0 = 1, #_list_1 do
|
||||||
local file = _list_1[_index_0]
|
local file = _list_1[_index_0]
|
||||||
if not exists(file) then
|
if not exists(file) then
|
||||||
error("Node " .. tostring(name) .. " has ran all of its parents, but can't run since " .. tostring(file) .. " doesn't exist")
|
error("Node " .. tostring(self.name) .. " has ran all of its parents, but can't run since " .. tostring(file) .. " doesn't exist. Did you mean to use after instead of depends?")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
@@ -1823,16 +2003,17 @@ do
|
|||||||
end
|
end
|
||||||
local force = opts.force or false
|
local force = opts.force or false
|
||||||
local quiet = opts.quiet or false
|
local quiet = opts.quiet or false
|
||||||
if self.built then
|
if self.built or #self.buildfunctions == 0 then
|
||||||
return
|
return false
|
||||||
end
|
end
|
||||||
if not (force or self:shouldbuild()) then
|
if not (force or self:shouldbuild()) then
|
||||||
return
|
return false
|
||||||
end
|
end
|
||||||
if not (quiet or #self.buildfunctions == 0) then
|
if not (quiet) then
|
||||||
print(tostring(self.type == 'virtual' and "Running" or "Building") .. " " .. tostring(self.name))
|
print(tostring(self.type == 'virtual' and "Running" or "Building") .. " " .. tostring(self.name) .. " [level " .. tostring(self.level) .. "]")
|
||||||
end
|
end
|
||||||
return self:actuallybuild()
|
self:actuallybuild()
|
||||||
|
return true
|
||||||
end,
|
end,
|
||||||
shouldbuild = function(self)
|
shouldbuild = function(self)
|
||||||
if #self.outs == 0 or #self.ins == 0 or self.type == 'virtual' then
|
if #self.outs == 0 or #self.ins == 0 or self.type == 'virtual' then
|
||||||
@@ -1877,11 +2058,11 @@ do
|
|||||||
local ctx = setmetatable({ }, {
|
local ctx = setmetatable({ }, {
|
||||||
__index = function(_, k)
|
__index = function(_, k)
|
||||||
local _exp_0 = k
|
local _exp_0 = k
|
||||||
if 'infile' == _exp_0 then
|
if 'infile' == _exp_0 or 'in' == _exp_0 then
|
||||||
return self.ins[1]
|
return self.ins[1]
|
||||||
elseif 'infiles' == _exp_0 then
|
elseif 'infiles' == _exp_0 then
|
||||||
return self.ins
|
return self.ins
|
||||||
elseif 'outfile' == _exp_0 then
|
elseif 'outfile' == _exp_0 or 'out' == _exp_0 then
|
||||||
return self.outs[1]
|
return self.outs[1]
|
||||||
elseif 'outfiles' == _exp_0 then
|
elseif 'outfiles' == _exp_0 then
|
||||||
return self.outs
|
return self.outs
|
||||||
@@ -1911,8 +2092,8 @@ do
|
|||||||
}
|
}
|
||||||
_base_0.__index = _base_0
|
_base_0.__index = _base_0
|
||||||
_class_0 = setmetatable({
|
_class_0 = setmetatable({
|
||||||
__init = function(self, dag, target, name)
|
__init = function(self, dag, target, name, level, errors)
|
||||||
self.dag, self.name = dag, name
|
self.dag, self.name, self.level = dag, name, level
|
||||||
self.priority = target.priority
|
self.priority = target.priority
|
||||||
self.buildfunctions = target.buildfunctions
|
self.buildfunctions = target.buildfunctions
|
||||||
self.mkdirs = target._mkdirs
|
self.mkdirs = target._mkdirs
|
||||||
@@ -1927,7 +2108,7 @@ do
|
|||||||
self.built = false
|
self.built = false
|
||||||
local resolve
|
local resolve
|
||||||
resolve = function(name)
|
resolve = function(name)
|
||||||
return self.dag:resolvedeps(patsubst(self.name, target.pattern, name))
|
return self.dag:resolvedeps((patsubst(self.name, target.pattern, name)), level + 1, errors)
|
||||||
end
|
end
|
||||||
local after = flatten(foreach(target.needtargets, resolve))
|
local after = flatten(foreach(target.needtargets, resolve))
|
||||||
local deps = flatten(foreach(target.infiles, resolve))
|
local deps = flatten(foreach(target.infiles, resolve))
|
||||||
@@ -1935,14 +2116,20 @@ do
|
|||||||
local ctx = setmetatable({ }, {
|
local ctx = setmetatable({ }, {
|
||||||
__index = function(_, k)
|
__index = function(_, k)
|
||||||
local _exp_0 = k
|
local _exp_0 = k
|
||||||
if 'infile' == _exp_0 then
|
if 'infile' == _exp_0 or 'in' == _exp_0 then
|
||||||
return first(deps)
|
local f = first(deps)
|
||||||
|
return f and f.name
|
||||||
elseif 'infiles' == _exp_0 then
|
elseif 'infiles' == _exp_0 then
|
||||||
return flatten(deps)
|
return foreach(deps, function(self)
|
||||||
elseif 'outfile' == _exp_0 then
|
return self.name
|
||||||
return first(self.outs)
|
end)
|
||||||
|
elseif 'outfile' == _exp_0 or 'out' == _exp_0 then
|
||||||
|
local f = first(self.outs)
|
||||||
|
return f and f.name
|
||||||
elseif 'outfiles' == _exp_0 then
|
elseif 'outfiles' == _exp_0 then
|
||||||
return flatten(self.outs)
|
return foreach(self.outs, function(self)
|
||||||
|
return self.name
|
||||||
|
end)
|
||||||
elseif 'name' == _exp_0 then
|
elseif 'name' == _exp_0 then
|
||||||
return self.name
|
return self.name
|
||||||
else
|
else
|
||||||
@@ -1956,9 +2143,7 @@ do
|
|||||||
local _list_0 = target.depfunctions
|
local _list_0 = target.depfunctions
|
||||||
for _index_0 = 1, #_list_0 do
|
for _index_0 = 1, #_list_0 do
|
||||||
local depfn = _list_0[_index_0]
|
local depfn = _list_0[_index_0]
|
||||||
deps = flatten(deps, foreach(depfn, function(fn)
|
deps = flatten(deps, foreach((runwithcontext(depfn, self.dag.env, ctx)), resolve))
|
||||||
return resolve(runwithcontext(fn, self.dag.env, ctx))
|
|
||||||
end))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.ins = foreach(deps, function(dep)
|
self.ins = foreach(deps, function(dep)
|
||||||
@@ -2028,6 +2213,123 @@ return DepGraph
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
do
|
||||||
|
local _ENV = _ENV
|
||||||
|
package.preload[ "moonbuild.core.Pipeline" ] = function( ... ) local arg = _G.arg;
|
||||||
|
local Target = require('moonbuild.core.Target')
|
||||||
|
local _ = require('moonbuild._')
|
||||||
|
local flatten, patsubst
|
||||||
|
flatten, patsubst = _.flatten, _.patsubst
|
||||||
|
local Pipeline
|
||||||
|
do
|
||||||
|
local _class_0
|
||||||
|
local _base_0 = {
|
||||||
|
sources = function(self, ...)
|
||||||
|
self.lastsources = flatten(self.lastsources, ...)
|
||||||
|
end,
|
||||||
|
source = function(self, src)
|
||||||
|
self.lastsources = flatten(self.lastsources, src)
|
||||||
|
end,
|
||||||
|
step = function(self, name, params)
|
||||||
|
local public = true
|
||||||
|
if (type(name)) == 'table' then
|
||||||
|
public, params = false, name
|
||||||
|
end
|
||||||
|
local tgttype
|
||||||
|
if params.pattern then
|
||||||
|
if not ((type(params.pattern)) == 'table' and (type(params.pattern[1])) == 'string' and (type(params.pattern[2])) == 'string') then
|
||||||
|
error("pattern must be a table with the same format as patsubst")
|
||||||
|
end
|
||||||
|
tgttype = 'pattern'
|
||||||
|
elseif params.output or params.out then
|
||||||
|
if not ((type(params.output or params.out)) == 'string') then
|
||||||
|
error("output must be a string")
|
||||||
|
end
|
||||||
|
tgttype = 'single'
|
||||||
|
else
|
||||||
|
tgttype = error("invalid step type for pipeline: must be pattern or single (out/output)")
|
||||||
|
end
|
||||||
|
local tgtouts
|
||||||
|
local _exp_0 = tgttype
|
||||||
|
if 'pattern' == _exp_0 then
|
||||||
|
tgtouts = patsubst(self.lastsources, params.pattern[1], params.pattern[2])
|
||||||
|
elseif 'single' == _exp_0 then
|
||||||
|
tgtouts = params.output or params.out
|
||||||
|
end
|
||||||
|
local tgtpatt
|
||||||
|
local _exp_1 = tgttype
|
||||||
|
if 'pattern' == _exp_1 then
|
||||||
|
tgtpatt = params.pattern[2]
|
||||||
|
elseif 'single' == _exp_1 then
|
||||||
|
tgtpatt = nil
|
||||||
|
end
|
||||||
|
local tgtins
|
||||||
|
local _exp_2 = tgttype
|
||||||
|
if 'pattern' == _exp_2 then
|
||||||
|
tgtins = params.pattern[1]
|
||||||
|
elseif 'single' == _exp_2 then
|
||||||
|
tgtins = self.lastsources
|
||||||
|
end
|
||||||
|
local tgtprod
|
||||||
|
local _exp_3 = tgttype
|
||||||
|
if 'pattern' == _exp_3 then
|
||||||
|
tgtprod = params.pattern[2]
|
||||||
|
elseif 'single' == _exp_3 then
|
||||||
|
tgtprod = '%'
|
||||||
|
end
|
||||||
|
local tgt
|
||||||
|
do
|
||||||
|
local _with_0 = Target(self.ctx, tgtouts, {
|
||||||
|
pattern = tgtpatt
|
||||||
|
})
|
||||||
|
_with_0:depends(tgtins)
|
||||||
|
_with_0:produces(tgtprod)
|
||||||
|
_with_0:fn(params.fn or error("pipeline steps need a fn"))
|
||||||
|
tgt = _with_0
|
||||||
|
end
|
||||||
|
if params.mkdirs then
|
||||||
|
tgt:mkdirs()
|
||||||
|
end
|
||||||
|
if params.sync then
|
||||||
|
tgt:sync()
|
||||||
|
end
|
||||||
|
self.ctx:addtarget(tgt)
|
||||||
|
if public then
|
||||||
|
self.ctx:addtarget((function()
|
||||||
|
do
|
||||||
|
local _with_0 = Target(self.ctx, name)
|
||||||
|
_with_0:depends(tgtouts)
|
||||||
|
_with_0.public = true
|
||||||
|
return _with_0
|
||||||
|
end
|
||||||
|
end)())
|
||||||
|
end
|
||||||
|
self.lastsources = tgtouts
|
||||||
|
end
|
||||||
|
}
|
||||||
|
_base_0.__index = _base_0
|
||||||
|
_class_0 = setmetatable({
|
||||||
|
__init = function(self, ctx)
|
||||||
|
self.ctx = ctx
|
||||||
|
self.lastsources = { }
|
||||||
|
end,
|
||||||
|
__base = _base_0,
|
||||||
|
__name = "Pipeline"
|
||||||
|
}, {
|
||||||
|
__index = _base_0,
|
||||||
|
__call = function(cls, ...)
|
||||||
|
local _self_0 = setmetatable({}, _base_0)
|
||||||
|
cls.__init(_self_0, ...)
|
||||||
|
return _self_0
|
||||||
|
end
|
||||||
|
})
|
||||||
|
_base_0.__class = _class_0
|
||||||
|
Pipeline = _class_0
|
||||||
|
return _class_0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
local _ENV = _ENV
|
local _ENV = _ENV
|
||||||
package.preload[ "moonbuild.core.Target" ] = function( ... ) local arg = _G.arg;
|
package.preload[ "moonbuild.core.Target" ] = function( ... ) local arg = _G.arg;
|
||||||
@@ -2148,7 +2450,23 @@ do
|
|||||||
__init = function(self, name, ...)
|
__init = function(self, name, ...)
|
||||||
self.name = name
|
self.name = name
|
||||||
self.public = false
|
self.public = false
|
||||||
if (select('#', ...)) ~= 1 or (type(...)) == 'table' then
|
if (type(self.name)) == 'table' then
|
||||||
|
if not ((type(next(self.name))) == 'string') then
|
||||||
|
error("not a valid var table: " .. tostring(next(self.name)))
|
||||||
|
end
|
||||||
|
if next(self.name, (next(self.name))) then
|
||||||
|
error("more than one var at once: " .. tostring(next(self.name)) .. ", " .. tostring(next(self.name, (next(self.name)))))
|
||||||
|
end
|
||||||
|
name = next(self.name)
|
||||||
|
local param
|
||||||
|
self.name, param = name, self.name
|
||||||
|
local val = param[name]
|
||||||
|
if (select('#', ...)) ~= 0 or (type(val)) == 'table' then
|
||||||
|
self.value = flatten(val, ...)
|
||||||
|
else
|
||||||
|
self.value = val
|
||||||
|
end
|
||||||
|
elseif (select('#', ...)) ~= 1 or (type(...)) == 'table' then
|
||||||
self.value = flatten(...)
|
self.value = flatten(...)
|
||||||
else
|
else
|
||||||
self.value = ...
|
self.value = ...
|
||||||
@@ -2173,9 +2491,20 @@ end
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
do
|
||||||
|
local _ENV = _ENV
|
||||||
|
package.preload[ "moonbuild.core.executor" ] = function( ... ) local arg = _G.arg;
|
||||||
|
local ok, MultiProcessExecutor = pcall(function()
|
||||||
|
return require('moonbuild.core.multiprocessexecutor')
|
||||||
|
end)
|
||||||
|
return ok and MultiProcessExecutor or require('moonbuild.core.singleprocessexecutor')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
local _ENV = _ENV
|
local _ENV = _ENV
|
||||||
package.preload[ "moonbuild.core.multiprocessexecutor" ] = function( ... ) local arg = _G.arg;
|
package.preload[ "moonbuild.core.multiprocessexecutor" ] = function( ... ) local arg = _G.arg;
|
||||||
|
local SingleProcessExecutor = require('moonbuild.core.singleprocessexecutor')
|
||||||
local fork, _exit
|
local fork, _exit
|
||||||
do
|
do
|
||||||
local _obj_0 = require('posix.unistd')
|
local _obj_0 = require('posix.unistd')
|
||||||
@@ -2195,6 +2524,9 @@ do
|
|||||||
local _class_0
|
local _class_0
|
||||||
local _base_0 = {
|
local _base_0 = {
|
||||||
execute = function(self, opts)
|
execute = function(self, opts)
|
||||||
|
if self.nparallel == 1 then
|
||||||
|
return (SingleProcessExecutor(self.dag, 1)):execute(opts)
|
||||||
|
end
|
||||||
local block = self.dag:buildablenodes()
|
local block = self.dag:buildablenodes()
|
||||||
while #block ~= 0 do
|
while #block ~= 0 do
|
||||||
for _index_0 = 1, #block do
|
for _index_0 = 1, #block do
|
||||||
@@ -2242,8 +2574,24 @@ do
|
|||||||
error("Node " .. tostring(name) .. " wasn't built")
|
error("Node " .. tostring(name) .. " wasn't built")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if not (opts.quiet) then
|
||||||
|
if self.nbuilt == 0 then
|
||||||
|
return print("Nothing to be done")
|
||||||
|
else
|
||||||
|
return print("Built " .. tostring(self.nbuilt) .. " targets")
|
||||||
|
end
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
addprocess = function(self, node, opts)
|
addprocess = function(self, node, opts)
|
||||||
|
if node.sync then
|
||||||
|
while self.nprocesses ~= 0 do
|
||||||
|
self:waitprocess()
|
||||||
|
end
|
||||||
|
node:build(opts)
|
||||||
|
node.built = true
|
||||||
|
node:updatecache()
|
||||||
|
return
|
||||||
|
end
|
||||||
local pid = fork()
|
local pid = fork()
|
||||||
if not (pid) then
|
if not (pid) then
|
||||||
error("Failed to fork")
|
error("Failed to fork")
|
||||||
@@ -2253,13 +2601,14 @@ do
|
|||||||
self.nprocesses = self.nprocesses + 1
|
self.nprocesses = self.nprocesses + 1
|
||||||
self.building[node] = true
|
self.building[node] = true
|
||||||
else
|
else
|
||||||
local ok, err = pcall(function()
|
local ok, status = pcall(function()
|
||||||
return node:build(opts)
|
return node:build(opts)
|
||||||
end)
|
end)
|
||||||
if ok then
|
if ok then
|
||||||
|
_exit(status and 0 or 2)
|
||||||
return _exit(0)
|
return _exit(0)
|
||||||
else
|
else
|
||||||
stderr:write(err)
|
stderr:write(status)
|
||||||
return _exit(1)
|
return _exit(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2269,13 +2618,16 @@ do
|
|||||||
if not (pid) then
|
if not (pid) then
|
||||||
error("Failed to wait")
|
error("Failed to wait")
|
||||||
end
|
end
|
||||||
if ty ~= 'exited' or status ~= 0 then
|
if ty ~= 'exited' or status ~= 0 and status ~= 2 then
|
||||||
error("Failed to build " .. tostring(self.processes[pid].name))
|
error("Failed to build " .. tostring(self.processes[pid].name))
|
||||||
end
|
end
|
||||||
self.processes[pid].built = true
|
self.processes[pid].built = true
|
||||||
self.processes[pid]:updatecache()
|
self.processes[pid]:updatecache()
|
||||||
self.processes[pid] = nil
|
self.processes[pid] = nil
|
||||||
self.nprocesses = self.nprocesses - 1
|
self.nprocesses = self.nprocesses - 1
|
||||||
|
if status == 0 then
|
||||||
|
self.nbuilt = self.nbuilt + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
_base_0.__index = _base_0
|
_base_0.__index = _base_0
|
||||||
@@ -2285,6 +2637,7 @@ do
|
|||||||
self.processes = { }
|
self.processes = { }
|
||||||
self.nprocesses = 0
|
self.nprocesses = 0
|
||||||
self.building = { }
|
self.building = { }
|
||||||
|
self.nbuilt = 0
|
||||||
end,
|
end,
|
||||||
__base = _base_0,
|
__base = _base_0,
|
||||||
__name = "Executor"
|
__name = "Executor"
|
||||||
@@ -2326,11 +2679,14 @@ do
|
|||||||
local _class_0
|
local _class_0
|
||||||
local _base_0 = {
|
local _base_0 = {
|
||||||
execute = function(self, opts)
|
execute = function(self, opts)
|
||||||
|
local nbuilt = 0
|
||||||
local block = self.dag:buildablenodes()
|
local block = self.dag:buildablenodes()
|
||||||
while #block ~= 0 do
|
while #block ~= 0 do
|
||||||
for _index_0 = 1, #block do
|
for _index_0 = 1, #block do
|
||||||
local node = block[_index_0]
|
local node = block[_index_0]
|
||||||
node:build(opts)
|
if node:build(opts) then
|
||||||
|
nbuilt = nbuilt + 1
|
||||||
|
end
|
||||||
node:updatecache()
|
node:updatecache()
|
||||||
node.built = true
|
node.built = true
|
||||||
end
|
end
|
||||||
@@ -2341,6 +2697,13 @@ do
|
|||||||
error("Node " .. tostring(name) .. " wasn't built")
|
error("Node " .. tostring(name) .. " wasn't built")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if not (opts.quiet) then
|
||||||
|
if nbuilt == 0 then
|
||||||
|
return print("Nothing to be done")
|
||||||
|
else
|
||||||
|
return print("Built " .. tostring(nbuilt) .. " targets")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
_base_0.__index = _base_0
|
_base_0.__index = _base_0
|
||||||
@@ -2399,6 +2762,7 @@ local _ENV = _ENV
|
|||||||
package.preload[ "moonbuild.env.init" ] = function( ... ) local arg = _G.arg;
|
package.preload[ "moonbuild.env.init" ] = function( ... ) local arg = _G.arg;
|
||||||
local Target = require('moonbuild.core.Target')
|
local Target = require('moonbuild.core.Target')
|
||||||
local Variable = require('moonbuild.core.Variable')
|
local Variable = require('moonbuild.core.Variable')
|
||||||
|
local Pipeline = require('moonbuild.core.Pipeline')
|
||||||
local _ = require('moonbuild._')
|
local _ = require('moonbuild._')
|
||||||
local flatten
|
local flatten
|
||||||
flatten = _.flatten
|
flatten = _.flatten
|
||||||
@@ -2418,10 +2782,10 @@ return function(ctx)
|
|||||||
rawset(env, '_', _)
|
rawset(env, '_', _)
|
||||||
rawset(env, '_G', env)
|
rawset(env, '_G', env)
|
||||||
rawset(env, '_ENV', env)
|
rawset(env, '_ENV', env)
|
||||||
rawset(env, 'var', function(name, ...)
|
rawset(env, 'var', function(...)
|
||||||
local var = Variable(name, ...)
|
local var = Variable(...)
|
||||||
ctx:addvar(var)
|
ctx:addvar(var)
|
||||||
rawset(varlayer, name, var.value)
|
rawset(varlayer, var.name, var.value)
|
||||||
return var
|
return var
|
||||||
end)
|
end)
|
||||||
rawset(env, 'target', function(name, opts)
|
rawset(env, 'target', function(name, opts)
|
||||||
@@ -2429,6 +2793,9 @@ return function(ctx)
|
|||||||
ctx:addtarget(target)
|
ctx:addtarget(target)
|
||||||
return target
|
return target
|
||||||
end)
|
end)
|
||||||
|
rawset(env, 'pipeline', function()
|
||||||
|
return Pipeline(ctx)
|
||||||
|
end)
|
||||||
return env, varlayer
|
return env, varlayer
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2476,47 +2843,85 @@ end
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
local loadfile
|
local loadfile
|
||||||
loadfile = require('moonscript.base').loadfile
|
loadfile = require('moonscript.base').loadfile
|
||||||
local Context = require('moonbuild.context')
|
local Context = require('moonbuild.context')
|
||||||
local Variable = require('moonbuild.core.Variable')
|
|
||||||
local DepGraph = require('moonbuild.core.DAG')
|
local DepGraph = require('moonbuild.core.DAG')
|
||||||
local sort, concat
|
local Executor = require('moonbuild.core.executor')
|
||||||
do
|
local _ = require('moonbuild._')
|
||||||
local _obj_0 = table
|
local insert
|
||||||
sort, concat = _obj_0.sort, _obj_0.concat
|
insert = table.insert
|
||||||
end
|
local moonbuild
|
||||||
return {
|
moonbuild = function(...)
|
||||||
tasks = {
|
local opts = { }
|
||||||
moonbuild = function(self)
|
for i = 1, select('#', ...) do
|
||||||
local args = {
|
local arg = select(i, ...)
|
||||||
nparallel = self.parallel or self.j,
|
if (type(arg)) == 'string' then
|
||||||
quiet = self.quiet or self.q,
|
insert(opts, arg)
|
||||||
buildfile = self.buildfile or self.b,
|
elseif (type(arg)) == 'table' then
|
||||||
force = self.force or self.f
|
for k, v in pairs(arg) do
|
||||||
}
|
if (type(k)) ~= 'number' then
|
||||||
local ctx = Context()
|
opts[k] = v
|
||||||
ctx:load((loadfile(args.buildfile or 'Build.moon')), self)
|
|
||||||
ctx:init()
|
|
||||||
local dag = DepGraph(ctx, #self == 0 and ctx.defaulttargets or self)
|
|
||||||
local executor
|
|
||||||
do
|
|
||||||
local Executor
|
|
||||||
do
|
|
||||||
local ok
|
|
||||||
ok, Executor = pcall(function()
|
|
||||||
return require('moonbuild.core.multiprocessexecutor')
|
|
||||||
end)
|
|
||||||
Executor = ok and Executor or require('moonbuild.core.singleprocessexecutor')
|
|
||||||
end
|
end
|
||||||
if args.nparallel == true then
|
|
||||||
args.nparallel = Executor:getmaxparallel()
|
|
||||||
end
|
|
||||||
executor = Executor(dag, args.nparallel)
|
|
||||||
end
|
end
|
||||||
return executor:execute(args)
|
for i, v in ipairs(arg) do
|
||||||
|
insert(opts, v)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
error("Invalid argument type " .. tostring(type(arg)) .. " for moonbuild")
|
||||||
end
|
end
|
||||||
}
|
end
|
||||||
}
|
local buildfile = opts.buildfile or opts.b or 'Build.moon'
|
||||||
|
opts.buildfile = buildfile
|
||||||
|
local parallel = opts.parallel or opts.j or 1
|
||||||
|
if parallel == 'y' then
|
||||||
|
parallel = true
|
||||||
|
end
|
||||||
|
opts.parallel = parallel
|
||||||
|
local quiet = opts.quiet or opts.q or false
|
||||||
|
opts.quiet = quiet
|
||||||
|
local force = opts.force or opts.f or false
|
||||||
|
opts.force = force
|
||||||
|
local verbose = opts.verbose or opts.v or false
|
||||||
|
opts.verbose = verbose
|
||||||
|
_.verbose(verbose)
|
||||||
|
local ctx = Context()
|
||||||
|
ctx:load((loadfile(buildfile)), opts)
|
||||||
|
_.verbose(function()
|
||||||
|
return print("Loaded buildfile")
|
||||||
|
end)
|
||||||
|
ctx:init()
|
||||||
|
_.verbose(function()
|
||||||
|
return print("Initialized buildfile")
|
||||||
|
end)
|
||||||
|
local targets = #opts == 0 and ctx.defaulttargets or opts
|
||||||
|
local dag = DepGraph(ctx, targets)
|
||||||
|
_.verbose(function()
|
||||||
|
return print("Created dependancy graph")
|
||||||
|
end)
|
||||||
|
local nparallel = parallel == true and Executor:getmaxparallel() or parallel
|
||||||
|
_.verbose(function()
|
||||||
|
return print("Building with " .. tostring(nparallel) .. " max parallel process" .. tostring(nparallel > 1 and "es" or ""))
|
||||||
|
end)
|
||||||
|
local executor = Executor(dag, nparallel)
|
||||||
|
executor:execute(opts)
|
||||||
|
_.verbose(function()
|
||||||
|
return print("Finished")
|
||||||
|
end)
|
||||||
|
return print(_.verbose())
|
||||||
|
end
|
||||||
|
local table = {
|
||||||
|
moonbuild = moonbuild,
|
||||||
|
_ = _,
|
||||||
|
Context = Context,
|
||||||
|
DepGraph = DepGraph,
|
||||||
|
Executor = Executor
|
||||||
|
}
|
||||||
|
return setmetatable(table, {
|
||||||
|
__call = function(self, ...)
|
||||||
|
return moonbuild(...)
|
||||||
|
end,
|
||||||
|
__index = function(self, name)
|
||||||
|
return require("moonbuild." .. tostring(name))
|
||||||
|
end
|
||||||
|
})
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package: moonbuild
|
package: moonbuild
|
||||||
source:
|
source:
|
||||||
url: git://github.com/natnat-mc/moonbuild
|
url: git+http://github.com/natnat-mc/moonbuild
|
||||||
description:
|
description:
|
||||||
summary: Small build system in between make and a build.sh
|
summary: Small build system in between make and a build.sh
|
||||||
detailed: >
|
detailed: >
|
||||||
@@ -22,3 +22,5 @@ build:
|
|||||||
install:
|
install:
|
||||||
bin:
|
bin:
|
||||||
moonbuild: out/moonbuild
|
moonbuild: out/moonbuild
|
||||||
|
modules:
|
||||||
|
moonbuild: out/moonbuild.lua
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
build = {
|
||||||
|
install = {
|
||||||
|
bin = {
|
||||||
|
moonbuild = "out/moonbuild"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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.1.0",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.1.0-1"
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
build = {
|
||||||
|
install = {
|
||||||
|
bin = {
|
||||||
|
moonbuild = "out/moonbuild"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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.1.0",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.1.0-2"
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
build = {
|
||||||
|
install = {
|
||||||
|
bin = {
|
||||||
|
moonbuild = "out/moonbuild"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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.1.0",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.1.0-3"
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
build = {
|
||||||
|
install = {
|
||||||
|
bin = {
|
||||||
|
moonbuild = "out/moonbuild"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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.1.1",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.1.1-1"
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
build = {
|
||||||
|
install = {
|
||||||
|
bin = {
|
||||||
|
moonbuild = "out/moonbuild"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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.1.2",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.1.2-1"
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
build = {
|
||||||
|
install = {
|
||||||
|
bin = {
|
||||||
|
moonbuild = "out/moonbuild"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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.1.2",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.1.2-2"
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
build = {
|
||||||
|
install = {
|
||||||
|
bin = {
|
||||||
|
moonbuild = "out/moonbuild"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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.1.3",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.1.3-1"
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
build = {
|
||||||
|
install = {
|
||||||
|
bin = {
|
||||||
|
moonbuild = "out/moonbuild"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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.1.3",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.1.3-2"
|
||||||
@@ -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.2.0",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.2.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.2.0",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.2.0-2"
|
||||||
@@ -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.2.1",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.2.1-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.2.2",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.2.2-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.2.2",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.2.2-2"
|
||||||
@@ -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.3.0",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.3.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.3.0",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.3.0-2"
|
||||||
@@ -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.4.0",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.4.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.5.0",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.5.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.5.1",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.5.1-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.6.0",
|
||||||
|
url = "git+http://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "2.6.0-1"
|
||||||
Reference in New Issue
Block a user