mirror of
https://github.com/natnat-mc/moonbuild
synced 2026-05-28 06:09:41 +02:00
Compare commits
12 Commits
alfons-task
...
v2.1.3
| Author | SHA1 | Date | |
|---|---|---|---|
| 77f73f3a21 | |||
| 31fcc58ccd | |||
| fcf7c3fa07 | |||
| 88a8117f06 | |||
| 69e781bc8f | |||
| ee0d76db98 | |||
| 6a6334fc78 | |||
| e5bd85933a | |||
| 50d0c662c5 | |||
| f742a3c003 | |||
| fcd3b07572 | |||
| b1f57c8929 |
@@ -16,6 +16,11 @@ with public default target 'all'
|
||||
\after 'bin'
|
||||
\after 'lib'
|
||||
|
||||
with public target 'install'
|
||||
\depends 'out/moonbuild'
|
||||
\produces '/usr/local/bin/moonbuild'
|
||||
\fn => _.cmd 'sudo', 'cp', @infile, @outfile
|
||||
|
||||
with public target 'clean'
|
||||
\fn => _.cmd RM, LIB_LUA
|
||||
\fn => _.cmd RM, BIN_LUA
|
||||
|
||||
@@ -16,6 +16,9 @@ MODULES = $(shell echo $(foreach lib, $(LIB_LUA), $(patsubst %.lua, %, $(lib)))
|
||||
|
||||
all: bin lib
|
||||
|
||||
install: all
|
||||
sudo cp out/moonbuild /usr/local/bin/moonbuild
|
||||
|
||||
clean:
|
||||
$(RM) $(LIB_LUA)
|
||||
$(RM) $(BIN_LUA)
|
||||
|
||||
@@ -14,8 +14,8 @@ _cdeps = (cc, cflags, path) ->
|
||||
rawlist = gsub (match raw, ':(.+)'), '\\\n', ' '
|
||||
[v for v in gmatch rawlist, '%S+']
|
||||
cdeps = setmetatable {},
|
||||
__index: (cc) => (cflags, path) -> _cdeps cc, cflags, path
|
||||
__call: (cflags, path) => _cdeps 'cc', cflags, path
|
||||
__index: (cc) => (path, cflags) -> _cdeps cc, cflags, path
|
||||
__call: (path, cflags) => _cdeps 'cc', cflags, path
|
||||
|
||||
readfile = (filename) ->
|
||||
fd, err = open filename, 'rb'
|
||||
|
||||
+25
-10
@@ -1,4 +1,4 @@
|
||||
import filter, foreach, flatten, patsubst from require 'moonbuild._common'
|
||||
import first, filter, foreach, flatten, patsubst from require 'moonbuild._common'
|
||||
import runwithcontext from require 'moonbuild.compat.ctx'
|
||||
globalenv = require 'moonbuild.env.global'
|
||||
import exists, parent, mkdirs, clearentry, disableentry, attributes from require 'moonbuild._fs'
|
||||
@@ -12,6 +12,8 @@ nodepriority = (a, b) ->
|
||||
tb = type b.name
|
||||
da = #a.deps
|
||||
db = #b.deps
|
||||
sa = a.sync
|
||||
sb = b.sync
|
||||
if ta=='string' and tb!='string'
|
||||
return true
|
||||
elseif ta!='string' and tb=='string'
|
||||
@@ -20,6 +22,10 @@ nodepriority = (a, b) ->
|
||||
return true
|
||||
elseif a.priority < b.priority
|
||||
return false
|
||||
elseif sa and not sb
|
||||
return false
|
||||
elseif sb and not sa
|
||||
return true
|
||||
else
|
||||
return da < db
|
||||
|
||||
@@ -28,6 +34,7 @@ transclosure = (obj, prop) ->
|
||||
i = 1
|
||||
set = {}
|
||||
imp = (e) ->
|
||||
return unless e[prop]
|
||||
for v in *e[prop]
|
||||
if not set[v]
|
||||
elems[i], i = v, i+1
|
||||
@@ -64,7 +71,7 @@ class DepGraph
|
||||
nodes = foreach candidates, (candidate) -> a: {pcall -> DepNode @, candidate, name}
|
||||
resolved = foreach (filter nodes, (node) -> node.a[1]), (node) -> node.a[2]
|
||||
sort resolved, nodepriority
|
||||
resolved[1] or error "Cannot resolve target #{name}"
|
||||
resolved[1] or error "Cannot resolve target #{name}: #{#candidates} candidates, #{#resolved} resolved"
|
||||
|
||||
buildablenodes: =>
|
||||
[v for k, v in pairs @nodes when v\canbuild! and not v.built]
|
||||
@@ -87,16 +94,24 @@ class DepNode
|
||||
ctx = setmetatable {},
|
||||
__index: (_, k) ->
|
||||
switch k
|
||||
when 'infile' then first deps
|
||||
when 'infiles' then flatten deps
|
||||
when 'outfile' then first @outs
|
||||
when 'outfiles' then flatten @outs
|
||||
when 'name' then @name
|
||||
else error "No such field in TargetDepsContext: #{k}"
|
||||
when 'infile'
|
||||
f = first deps
|
||||
f and f.name
|
||||
when 'infiles'
|
||||
foreach deps, => @name
|
||||
when 'outfile'
|
||||
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) =>
|
||||
error "Attempt to set field #{k} of TargetDepsContext"
|
||||
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
|
||||
@after = foreach after, (dep) -> dep.name
|
||||
@deps = flatten { deps, after }
|
||||
@@ -108,7 +123,7 @@ class DepNode
|
||||
return false
|
||||
for file in *@ins
|
||||
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
|
||||
|
||||
build: (opts={}) =>
|
||||
|
||||
@@ -37,6 +37,14 @@ class Executor
|
||||
error "Node #{name} wasn't built" unless node.built
|
||||
|
||||
addprocess: (node, opts) =>
|
||||
if node.sync
|
||||
while @nprocesses != 0
|
||||
@waitprocess!
|
||||
node\build opts
|
||||
node.built = true
|
||||
node\updatecache!
|
||||
return
|
||||
|
||||
pid = fork!
|
||||
error "Failed to fork" unless pid
|
||||
if pid!=0
|
||||
|
||||
+35
-13
@@ -1272,11 +1272,11 @@ _cdeps = function(cc, cflags, path)
|
||||
end
|
||||
local cdeps = setmetatable({ }, {
|
||||
__index = function(self, cc)
|
||||
return function(cflags, path)
|
||||
return function(path, cflags)
|
||||
return _cdeps(cc, cflags, path)
|
||||
end
|
||||
end,
|
||||
__call = function(self, cflags, path)
|
||||
__call = function(self, path, cflags)
|
||||
return _cdeps('cc', cflags, path)
|
||||
end
|
||||
})
|
||||
@@ -1646,10 +1646,10 @@ end
|
||||
do
|
||||
local _ENV = _ENV
|
||||
package.preload[ "moonbuild.core.DAG" ] = function( ... ) local arg = _G.arg;
|
||||
local filter, foreach, flatten, patsubst
|
||||
local first, filter, foreach, flatten, patsubst
|
||||
do
|
||||
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 = _obj_0.first, _obj_0.filter, _obj_0.foreach, _obj_0.flatten, _obj_0.patsubst
|
||||
end
|
||||
local runwithcontext
|
||||
runwithcontext = require('moonbuild.compat.ctx').runwithcontext
|
||||
@@ -1670,6 +1670,8 @@ nodepriority = function(a, b)
|
||||
local tb = type(b.name)
|
||||
local da = #a.deps
|
||||
local db = #b.deps
|
||||
local sa = a.sync
|
||||
local sb = b.sync
|
||||
if ta == 'string' and tb ~= 'string' then
|
||||
return true
|
||||
elseif ta ~= 'string' and tb == 'string' then
|
||||
@@ -1678,6 +1680,10 @@ nodepriority = function(a, b)
|
||||
return true
|
||||
elseif a.priority < b.priority then
|
||||
return false
|
||||
elseif sa and not sb then
|
||||
return false
|
||||
elseif sb and not sa then
|
||||
return true
|
||||
else
|
||||
return da < db
|
||||
end
|
||||
@@ -1689,6 +1695,9 @@ transclosure = function(obj, prop)
|
||||
local set = { }
|
||||
local imp
|
||||
imp = function(e)
|
||||
if not (e[prop]) then
|
||||
return
|
||||
end
|
||||
local _list_0 = e[prop]
|
||||
for _index_0 = 1, #_list_0 do
|
||||
local v = _list_0[_index_0]
|
||||
@@ -1753,7 +1762,7 @@ do
|
||||
return node.a[2]
|
||||
end)
|
||||
sort(resolved, nodepriority)
|
||||
return resolved[1] or error("Cannot resolve target " .. tostring(name))
|
||||
return resolved[1] or error("Cannot resolve target " .. tostring(name) .. ": " .. tostring(#candidates) .. " candidates, " .. tostring(#resolved) .. " resolved")
|
||||
end,
|
||||
buildablenodes = function(self)
|
||||
local _accum_0 = { }
|
||||
@@ -1812,7 +1821,7 @@ do
|
||||
for _index_0 = 1, #_list_1 do
|
||||
local file = _list_1[_index_0]
|
||||
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
|
||||
return true
|
||||
@@ -1936,13 +1945,19 @@ do
|
||||
__index = function(_, k)
|
||||
local _exp_0 = k
|
||||
if 'infile' == _exp_0 then
|
||||
return first(deps)
|
||||
local f = first(deps)
|
||||
return f and f.name
|
||||
elseif 'infiles' == _exp_0 then
|
||||
return flatten(deps)
|
||||
return foreach(deps, function(self)
|
||||
return self.name
|
||||
end)
|
||||
elseif 'outfile' == _exp_0 then
|
||||
return first(self.outs)
|
||||
local f = first(self.outs)
|
||||
return f and f.name
|
||||
elseif 'outfiles' == _exp_0 then
|
||||
return flatten(self.outs)
|
||||
return foreach(self.outs, function(self)
|
||||
return self.name
|
||||
end)
|
||||
elseif 'name' == _exp_0 then
|
||||
return self.name
|
||||
else
|
||||
@@ -1956,9 +1971,7 @@ do
|
||||
local _list_0 = target.depfunctions
|
||||
for _index_0 = 1, #_list_0 do
|
||||
local depfn = _list_0[_index_0]
|
||||
deps = flatten(deps, foreach(depfn, function(fn)
|
||||
return resolve(runwithcontext(fn, self.dag.env, ctx))
|
||||
end))
|
||||
deps = flatten(deps, foreach((runwithcontext(depfn, self.dag.env, ctx)), resolve))
|
||||
end
|
||||
end
|
||||
self.ins = foreach(deps, function(dep)
|
||||
@@ -2244,6 +2257,15 @@ do
|
||||
end
|
||||
end,
|
||||
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()
|
||||
if not (pid) then
|
||||
error("Failed to fork")
|
||||
|
||||
@@ -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"
|
||||
Reference in New Issue
Block a user