mirror of
https://github.com/natnat-mc/moonbuild
synced 2026-05-28 11:59:41 +02:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a125eab22f | |||
| 0c43e3a5b1 |
+25
-7
@@ -22,8 +22,8 @@ makecached = function(fn)
|
|||||||
freeze = function(val)
|
freeze = function(val)
|
||||||
cache[val] = FROZEN
|
cache[val] = FROZEN
|
||||||
end
|
end
|
||||||
local reset
|
local clear
|
||||||
reset = function()
|
clear = function()
|
||||||
cache = { }
|
cache = { }
|
||||||
end
|
end
|
||||||
local get
|
local get
|
||||||
@@ -44,7 +44,7 @@ makecached = function(fn)
|
|||||||
get = get,
|
get = get,
|
||||||
invalidate = invalidate,
|
invalidate = invalidate,
|
||||||
freeze = freeze,
|
freeze = freeze,
|
||||||
reset = reset
|
clear = clear
|
||||||
}, {
|
}, {
|
||||||
__call = function(self, val)
|
__call = function(self, val)
|
||||||
return get(val)
|
return get(val)
|
||||||
@@ -53,7 +53,15 @@ makecached = function(fn)
|
|||||||
end
|
end
|
||||||
return {
|
return {
|
||||||
attributes = makecached(attributes),
|
attributes = makecached(attributes),
|
||||||
dir = makecached(dir)
|
dir = makecached(function(file)
|
||||||
|
local _accum_0 = { }
|
||||||
|
local _len_0 = 1
|
||||||
|
for k in dir(file) do
|
||||||
|
_accum_0[_len_0] = k
|
||||||
|
_len_0 = _len_0 + 1
|
||||||
|
end
|
||||||
|
return _accum_0
|
||||||
|
end)
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -118,7 +126,9 @@ local ls
|
|||||||
ls = function(d)
|
ls = function(d)
|
||||||
local _accum_0 = { }
|
local _accum_0 = { }
|
||||||
local _len_0 = 1
|
local _len_0 = 1
|
||||||
for f in dir(normalizepath(d)) do
|
local _list_0 = dir(normalizepath(d))
|
||||||
|
for _index_0 = 1, #_list_0 do
|
||||||
|
local f = _list_0[_index_0]
|
||||||
if f ~= '.' and f ~= '..' then
|
if f ~= '.' and f ~= '..' then
|
||||||
_accum_0[_len_0] = f
|
_accum_0[_len_0] = f
|
||||||
_len_0 = _len_0 + 1
|
_len_0 = _len_0 + 1
|
||||||
@@ -133,7 +143,9 @@ lswithpath = function(d)
|
|||||||
end
|
end
|
||||||
local _accum_0 = { }
|
local _accum_0 = { }
|
||||||
local _len_0 = 1
|
local _len_0 = 1
|
||||||
for f in dir(normalizepath(d)) do
|
local _list_0 = dir(normalizepath(d))
|
||||||
|
for _index_0 = 1, #_list_0 do
|
||||||
|
local f = _list_0[_index_0]
|
||||||
if f ~= '.' and f ~= '..' then
|
if f ~= '.' and f ~= '..' then
|
||||||
_accum_0[_len_0] = d .. '/' .. f
|
_accum_0[_len_0] = d .. '/' .. f
|
||||||
_len_0 = _len_0 + 1
|
_len_0 = _len_0 + 1
|
||||||
@@ -264,6 +276,11 @@ invalidatecache = function(file)
|
|||||||
dir.invalidate(parentdir(file))
|
dir.invalidate(parentdir(file))
|
||||||
return attributes.invalidate(file)
|
return attributes.invalidate(file)
|
||||||
end
|
end
|
||||||
|
local clearcache
|
||||||
|
clearcache = function()
|
||||||
|
dir.clear()
|
||||||
|
return attributes.clear()
|
||||||
|
end
|
||||||
return {
|
return {
|
||||||
wildcard = wildcard,
|
wildcard = wildcard,
|
||||||
exists = exists,
|
exists = exists,
|
||||||
@@ -272,7 +289,8 @@ return {
|
|||||||
normalizepath = normalizepath,
|
normalizepath = normalizepath,
|
||||||
parentdir = parentdir,
|
parentdir = parentdir,
|
||||||
freezecache = freezecache,
|
freezecache = freezecache,
|
||||||
invalidatecache = invalidatecache
|
invalidatecache = invalidatecache,
|
||||||
|
clearcache = clearcache
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ makecached = (fn) ->
|
|||||||
freeze = (val) ->
|
freeze = (val) ->
|
||||||
cache[val] = FROZEN
|
cache[val] = FROZEN
|
||||||
|
|
||||||
reset = ->
|
clear = ->
|
||||||
cache = {}
|
cache = {}
|
||||||
|
|
||||||
get = (val) ->
|
get = (val) ->
|
||||||
@@ -24,10 +24,10 @@ makecached = (fn) ->
|
|||||||
cache[val] = ret
|
cache[val] = ret
|
||||||
unpack ret
|
unpack ret
|
||||||
|
|
||||||
setmetatable { :get, :invalidate, :freeze, :reset },
|
setmetatable { :get, :invalidate, :freeze, :clear },
|
||||||
__call: (val) => get val
|
__call: (val) => get val
|
||||||
|
|
||||||
{
|
{
|
||||||
attributes: makecached attributes
|
attributes: makecached attributes
|
||||||
dir: makecached dir
|
dir: makecached (file) -> [k for k in dir file]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,12 +19,11 @@ normalizepath = (file) ->
|
|||||||
(absolute and '/' or '') .. concat parts, '/'
|
(absolute and '/' or '') .. concat parts, '/'
|
||||||
|
|
||||||
ls = (d) ->
|
ls = (d) ->
|
||||||
[f for f in dir normalizepath d when f!='.' and f!='..']
|
[f for f in *dir normalizepath d when f!='.' and f!='..']
|
||||||
|
|
||||||
lswithpath = (d) ->
|
lswithpath = (d) ->
|
||||||
if d==''
|
return ls '.' if d==''
|
||||||
return ls '.'
|
[d..'/'..f for f in *dir normalizepath d when f!='.' and f!='..']
|
||||||
[d..'/'..f for f in dir normalizepath d when f!='.' and f!='..']
|
|
||||||
|
|
||||||
exists = (f) ->
|
exists = (f) ->
|
||||||
(attributes normalizepath f) != nil
|
(attributes normalizepath f) != nil
|
||||||
@@ -109,10 +108,14 @@ invalidatecache = (file) ->
|
|||||||
dir.invalidate parentdir file
|
dir.invalidate parentdir file
|
||||||
attributes.invalidate file
|
attributes.invalidate file
|
||||||
|
|
||||||
|
clearcache = ->
|
||||||
|
dir.clear!
|
||||||
|
attributes.clear!
|
||||||
|
|
||||||
{
|
{
|
||||||
:wildcard
|
:wildcard
|
||||||
:exists, :isdir
|
:exists, :isdir
|
||||||
:mtime
|
:mtime
|
||||||
:normalizepath, :parentdir
|
:normalizepath, :parentdir
|
||||||
:freezecache, :invalidatecache
|
:freezecache, :invalidatecache, :clearcache
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
build = {
|
||||||
|
install = {
|
||||||
|
bin = {
|
||||||
|
moonbuild = "moonbuild.lua"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
type = "builtin"
|
||||||
|
}
|
||||||
|
dependencies = {
|
||||||
|
"lua >= 5.3",
|
||||||
|
"luafilesystem >= 1.7.0"
|
||||||
|
}
|
||||||
|
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)\n",
|
||||||
|
summary = "Small build system in between make and a build.sh"
|
||||||
|
}
|
||||||
|
package = "moonbuild"
|
||||||
|
rockspec_format = "3.0"
|
||||||
|
source = {
|
||||||
|
tag = "v1.1.1",
|
||||||
|
url = "git://github.com/natnat-mc/moonbuild"
|
||||||
|
}
|
||||||
|
version = "1.1.1-1"
|
||||||
Reference in New Issue
Block a user