mirror of
https://github.com/natnat-mc/moonbuild
synced 2026-05-28 08:29:40 +02:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 678313d09f | |||
| ebd380fb0f | |||
| 803d1093bb | |||
| ec5fc1cf7d | |||
| 17578bb721 | |||
| d3c8414086 | |||
| d43e9350d3 | |||
| 0f3506c7b7 | |||
| eb28c9c8bb | |||
| e0afeaaf07 |
+7
-7
@@ -1,13 +1,13 @@
|
|||||||
tasks:
|
require 'moonscript'
|
||||||
bootstrap: => sh "moon bin/moonbuild.moon -jy"
|
moonbuild = require 'moonbuild'
|
||||||
bootstrapinstall: => sh "moon bin/moonbuild.moon install -jy"
|
|
||||||
|
|
||||||
|
tasks:
|
||||||
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"
|
||||||
|
|
||||||
build: => (require 'moonbuild') j: true
|
build: => moonbuild j: true
|
||||||
install: => (require 'moonbuild') 'install', j: true
|
install: => moonbuild 'install', j: true
|
||||||
clean: => (require 'moonbuild') 'clean'
|
clean: => moonbuild 'clean'
|
||||||
mrproper: => (require 'moonbuild') 'mrproper'
|
mrproper: => moonbuild 'mrproper'
|
||||||
|
|||||||
+35
-40
@@ -1,16 +1,16 @@
|
|||||||
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'
|
||||||
@@ -21,15 +21,15 @@ with public target 'install'
|
|||||||
\after 'install-lib'
|
\after 'install-lib'
|
||||||
|
|
||||||
with public target 'install-bin'
|
with public target 'install-bin'
|
||||||
\depends 'out/moonbuild'
|
\depends BIN
|
||||||
\produces '/usr/local/bin/moonbuild'
|
\produces _.patsubst BIN, 'out/%', '/usr/local/bin/%'
|
||||||
\fn => _.cmd 'sudo', 'cp', @infile, @outfile
|
\fn => _.cmd 'sudo', 'cp', @infile, @out
|
||||||
\sync!
|
\sync!
|
||||||
|
|
||||||
with public target 'install-lib'
|
with public target 'install-lib'
|
||||||
\depends 'out/moonbuild.lua'
|
\depends LIB
|
||||||
\produces "/usr/local/share/lua/#{LUA\gsub 'lua', ''}/moonbuild.lua"
|
\produces "/usr/local/share/lua/#{LUA\gsub 'lua', ''}/moonbuild.lua"
|
||||||
\fn => _.cmd 'sudo', 'cp', @infile, @outfile
|
\fn => _.cmd 'sudo', 'cp', @infile, @out
|
||||||
\sync!
|
\sync!
|
||||||
|
|
||||||
with public target 'clean'
|
with public target 'clean'
|
||||||
@@ -38,30 +38,25 @@ with public target 'clean'
|
|||||||
|
|
||||||
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
|
||||||
\produces 'out/%'
|
\step 'bin'
|
||||||
\mkdirs!
|
pattern: {'bin/%.lua', 'out/%'}
|
||||||
\fn =>
|
mkdirs: true
|
||||||
_.writefile @outfile, "#!/usr/bin/env #{LUA}\n#{_.readfile @infile}"
|
fn: =>
|
||||||
_.cmd 'chmod', '+x', @outfile
|
_.writefile @out, "#!/usr/bin/env #{LUA}\n#{_.readfile @infile}"
|
||||||
|
_.cmd 'chmod', '+x', @out
|
||||||
with target 'out/moonbuild.lua'
|
|
||||||
\depends 'moonbuild/init.lua'
|
|
||||||
\depends LIB_LUA
|
|
||||||
\produces '%'
|
|
||||||
\fn =>
|
|
||||||
_.cmd AMALG, '-o', @outfile, '-s', @infile, _.exclude MODULES, 'moonbuild.init'
|
|
||||||
|
|
||||||
with target {LIB_LUA, BIN_LUA}, pattern: '%.lua'
|
|
||||||
\depends '%.moon'
|
|
||||||
\produces '%.lua'
|
|
||||||
\fn => _.moonc @infile, @outfile
|
|
||||||
|
|||||||
@@ -16,27 +16,27 @@ MODULES = $(shell echo $(foreach lib, $(LIB_LUA), $(patsubst %.lua, %, $(lib)))
|
|||||||
|
|
||||||
all: bin lib
|
all: bin lib
|
||||||
|
|
||||||
install: all
|
|
||||||
sudo cp out/moonbuild /usr/local/bin/moonbuild
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) $(LIB_LUA)
|
$(RM) $(LIB_LUA)
|
||||||
$(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 $^
|
||||||
|
|||||||
@@ -27,5 +27,10 @@ You can build moonbuild with itself: `moon bin/moonbuild.moon -qjy`.
|
|||||||
This will leave the binary ready to be used as `out/moonbuild` (it will still depend on the library to be used).
|
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`.
|
The binary and library can then be installed with `bin/moonbuild install`.
|
||||||
|
|
||||||
|
You can combine these steps with `moon bin/moonbuild.moon -qjy install` which will build and install 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
|
||||||
|
|||||||
+7
-1
@@ -17,5 +17,11 @@ cmd.backend = backend
|
|||||||
cmd.parseargs = parseargs
|
cmd.parseargs = parseargs
|
||||||
cmd.escape = escape
|
cmd.escape = escape
|
||||||
|
|
||||||
|
-- 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'}
|
||||||
|
|||||||
@@ -108,12 +108,12 @@ class DepNode
|
|||||||
ctx = setmetatable {},
|
ctx = setmetatable {},
|
||||||
__index: (_, k) ->
|
__index: (_, k) ->
|
||||||
switch k
|
switch k
|
||||||
when 'infile'
|
when 'infile', 'in'
|
||||||
f = first deps
|
f = first deps
|
||||||
f and f.name
|
f and f.name
|
||||||
when 'infiles'
|
when 'infiles'
|
||||||
foreach deps, => @name
|
foreach deps, => @name
|
||||||
when 'outfile'
|
when 'outfile', 'out'
|
||||||
f = first @outs
|
f = first @outs
|
||||||
f and f.name
|
f and f.name
|
||||||
when 'outfiles'
|
when 'outfiles'
|
||||||
@@ -182,9 +182,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 = ...
|
||||||
|
|||||||
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
|
||||||
|
|||||||
+155
-8
@@ -69,11 +69,21 @@ end
|
|||||||
cmd.backend = backend
|
cmd.backend = backend
|
||||||
cmd.parseargs = parseargs
|
cmd.parseargs = parseargs
|
||||||
cmd.escape = escape
|
cmd.escape = escape
|
||||||
|
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
|
||||||
@@ -1942,11 +1952,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
|
||||||
@@ -2000,14 +2010,14 @@ 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
|
||||||
local f = first(deps)
|
local f = first(deps)
|
||||||
return f and f.name
|
return f and f.name
|
||||||
elseif 'infiles' == _exp_0 then
|
elseif 'infiles' == _exp_0 then
|
||||||
return foreach(deps, function(self)
|
return foreach(deps, function(self)
|
||||||
return self.name
|
return self.name
|
||||||
end)
|
end)
|
||||||
elseif 'outfile' == _exp_0 then
|
elseif 'outfile' == _exp_0 or 'out' == _exp_0 then
|
||||||
local f = first(self.outs)
|
local f = first(self.outs)
|
||||||
return f and f.name
|
return f and f.name
|
||||||
elseif 'outfiles' == _exp_0 then
|
elseif 'outfiles' == _exp_0 then
|
||||||
@@ -2097,6 +2107,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;
|
||||||
@@ -2217,7 +2344,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 = ...
|
||||||
@@ -2513,6 +2656,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
|
||||||
@@ -2532,10 +2676,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)
|
||||||
@@ -2543,6 +2687,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
|
||||||
|
|||||||
@@ -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"
|
||||||
Reference in New Issue
Block a user