mirror of
https://github.com/natnat-mc/moonbuild
synced 2026-05-28 16:29:41 +02:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0779ea3ad4 | |||
| e3e185110a | |||
| 7b4973f0b4 | |||
| c96b2ece70 | |||
| 0e23ccecfb | |||
| ccce358155 |
+20
-13
@@ -127,12 +127,11 @@ class BuildObject
|
||||
for i=1, #@outs
|
||||
return true if not otimes[i]
|
||||
|
||||
(max itimes)>=(min otimes)
|
||||
(max itimes)>(min otimes)
|
||||
|
||||
error "Need Lua >=5.2" if setfenv
|
||||
|
||||
targets = {}
|
||||
defaulttarget = 'all'
|
||||
local targets, defaulttarget
|
||||
|
||||
buildscope =
|
||||
default: (target) ->
|
||||
@@ -158,14 +157,25 @@ setmetatable buildscope,
|
||||
return global if global
|
||||
(...) -> Command k, ...
|
||||
|
||||
file = first {'Build.moon', 'Buildfile.moon', 'Build', 'Buildfile'}, exists
|
||||
error "No Build.moon or Buildfile found" unless file
|
||||
buildfn = loadwithscope file, buildscope
|
||||
error "Failed to load build function" unless buildfn
|
||||
ok, err = pcall buildfn
|
||||
loadtargets = ->
|
||||
targets = {}
|
||||
defaulttarget = 'all'
|
||||
file = first {'Build.moon', 'Buildfile.moon', 'Build', 'Buildfile'}, exists
|
||||
error "No Build.moon or Buildfile found" unless file
|
||||
buildfn = loadwithscope file, buildscope
|
||||
error "Failed to load build function" unless buildfn
|
||||
buildfn!
|
||||
|
||||
buildtargets = ->
|
||||
if #args.targets==0
|
||||
BuildObject\build defaulttarget
|
||||
for target in *args.targets
|
||||
BuildObject\build target
|
||||
|
||||
ok, err = pcall loadtargets
|
||||
unless ok
|
||||
if err
|
||||
io.stderr\write err, '\n'
|
||||
io.stderr\write "Error while loading build file: ", err, '\n'
|
||||
else
|
||||
io.stderr\write "Unknown error\n"
|
||||
os.exit 1
|
||||
@@ -197,7 +207,4 @@ if args.deps
|
||||
io.write "\n"
|
||||
os.exit 0
|
||||
|
||||
if #args.targets==0
|
||||
BuildObject\build defaulttarget
|
||||
for target in *args.targets
|
||||
BuildObject\build target
|
||||
buildtargets!
|
||||
|
||||
+41
-28
@@ -120,7 +120,11 @@ normalizepath = function(file)
|
||||
break
|
||||
end
|
||||
end
|
||||
return (absolute and '/' or '') .. concat(parts, '/')
|
||||
if #parts == 0 then
|
||||
return '.'
|
||||
else
|
||||
return (absolute and '/' or '') .. concat(parts, '/')
|
||||
end
|
||||
end
|
||||
local ls
|
||||
ls = function(d)
|
||||
@@ -201,7 +205,7 @@ wildcard = function(glob)
|
||||
local absolute = (sub(glob, 1, 1)) == '/'
|
||||
for i, part in ipairs(parts) do
|
||||
local prevpath = (absolute and '/' or '') .. concat(parts, '/', 1, i - 1)
|
||||
local currpath = prevpath .. '/' .. part
|
||||
local currpath = (i == 1 and '' or (prevpath .. '/')) .. part
|
||||
if match(part, '%*%*.*%*%*') then
|
||||
error("Two '**' in the same path component in a wildcard")
|
||||
end
|
||||
@@ -394,7 +398,7 @@ min = function(table, cmp)
|
||||
local val = table[1]
|
||||
for i = 2, #table do
|
||||
local elem = table[i]
|
||||
if cmp(val, elem) then
|
||||
if cmp(elem, val) then
|
||||
val = elem
|
||||
end
|
||||
end
|
||||
@@ -410,7 +414,7 @@ max = function(table, cmp)
|
||||
local val = table[1]
|
||||
for i = 2, #table do
|
||||
local elem = table[i]
|
||||
if not cmp(val, elem) then
|
||||
if not cmp(elem, val) then
|
||||
val = elem
|
||||
end
|
||||
end
|
||||
@@ -959,7 +963,7 @@ do
|
||||
return true
|
||||
end
|
||||
end
|
||||
return (max(itimes)) >= (min(otimes))
|
||||
return (max(itimes)) > (min(otimes))
|
||||
end
|
||||
}
|
||||
_base_0.__index = _base_0
|
||||
@@ -1034,8 +1038,7 @@ end
|
||||
if setfenv then
|
||||
error("Need Lua >=5.2")
|
||||
end
|
||||
local targets = { }
|
||||
local defaulttarget = 'all'
|
||||
local targets, defaulttarget
|
||||
local buildscope = {
|
||||
default = function(target)
|
||||
defaulttarget = target.name
|
||||
@@ -1073,23 +1076,40 @@ setmetatable(buildscope, {
|
||||
end
|
||||
end
|
||||
})
|
||||
local file = first({
|
||||
'Build.moon',
|
||||
'Buildfile.moon',
|
||||
'Build',
|
||||
'Buildfile'
|
||||
}, exists)
|
||||
if not (file) then
|
||||
error("No Build.moon or Buildfile found")
|
||||
local loadtargets
|
||||
loadtargets = function()
|
||||
targets = { }
|
||||
defaulttarget = 'all'
|
||||
local file = first({
|
||||
'Build.moon',
|
||||
'Buildfile.moon',
|
||||
'Build',
|
||||
'Buildfile'
|
||||
}, exists)
|
||||
if not (file) then
|
||||
error("No Build.moon or Buildfile found")
|
||||
end
|
||||
local buildfn = loadwithscope(file, buildscope)
|
||||
if not (buildfn) then
|
||||
error("Failed to load build function")
|
||||
end
|
||||
return buildfn()
|
||||
end
|
||||
local buildfn = loadwithscope(file, buildscope)
|
||||
if not (buildfn) then
|
||||
error("Failed to load build function")
|
||||
local buildtargets
|
||||
buildtargets = function()
|
||||
if #args.targets == 0 then
|
||||
BuildObject:build(defaulttarget)
|
||||
end
|
||||
local _list_0 = args.targets
|
||||
for _index_0 = 1, #_list_0 do
|
||||
local target = _list_0[_index_0]
|
||||
BuildObject:build(target)
|
||||
end
|
||||
end
|
||||
local ok, err = pcall(buildfn)
|
||||
local ok, err = pcall(loadtargets)
|
||||
if not (ok) then
|
||||
if err then
|
||||
io.stderr:write(err, '\n')
|
||||
io.stderr:write("Error while loading build file: ", err, '\n')
|
||||
else
|
||||
io.stderr:write("Unknown error\n")
|
||||
end
|
||||
@@ -1130,11 +1150,4 @@ if args.deps then
|
||||
end
|
||||
os.exit(0)
|
||||
end
|
||||
if #args.targets == 0 then
|
||||
BuildObject:build(defaulttarget)
|
||||
end
|
||||
local _list_0 = args.targets
|
||||
for _index_0 = 1, #_list_0 do
|
||||
local target = _list_0[_index_0]
|
||||
BuildObject:build(target)
|
||||
end
|
||||
return buildtargets()
|
||||
|
||||
@@ -16,7 +16,10 @@ normalizepath = (file) ->
|
||||
remove parts, i-1
|
||||
i -= 2
|
||||
continue
|
||||
(absolute and '/' or '') .. concat parts, '/'
|
||||
if #parts==0
|
||||
'.'
|
||||
else
|
||||
(absolute and '/' or '') .. concat parts, '/'
|
||||
|
||||
ls = (d) ->
|
||||
[f for f in *dir normalizepath d when f!='.' and f!='..']
|
||||
@@ -54,7 +57,7 @@ wildcard = (glob) ->
|
||||
|
||||
for i, part in ipairs parts
|
||||
prevpath = (absolute and '/' or '') .. concat parts, '/', 1, i-1
|
||||
currpath = prevpath .. '/' .. part
|
||||
currpath = (i==1 and '' or (prevpath .. '/')) .. part
|
||||
|
||||
if match part, '%*%*.*%*%*'
|
||||
error "Two '**' in the same path component in a wildcard"
|
||||
|
||||
@@ -12,7 +12,7 @@ min = (table, cmp=(a, b) -> a<b) ->
|
||||
val = table[1]
|
||||
for i=2, #table
|
||||
elem = table[i]
|
||||
if cmp val, elem
|
||||
if cmp elem, val
|
||||
val = elem
|
||||
val
|
||||
|
||||
@@ -20,7 +20,7 @@ max = (table, cmp=(a, b) -> a<b) ->
|
||||
val = table[1]
|
||||
for i=2, #table
|
||||
elem = table[i]
|
||||
if not cmp val, elem
|
||||
if not cmp elem, val
|
||||
val = elem
|
||||
val
|
||||
|
||||
|
||||
@@ -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.2",
|
||||
url = "git://github.com/natnat-mc/moonbuild"
|
||||
}
|
||||
version = "1.1.2-1"
|
||||
@@ -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.3",
|
||||
url = "git://github.com/natnat-mc/moonbuild"
|
||||
}
|
||||
version = "1.1.3-1"
|
||||
Reference in New Issue
Block a user