aboutsummaryrefslogtreecommitdiffstats
path: root/root/Tupdefault.lua
blob: 260ca2ed7c0687a66327e634b000a49c94160a96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
local LUA_PATH = lua_path()
bundle = LUA_PATH .. ' moon ' .. build .. '/bundle_fileder.moon'
render = LUA_PATH .. ' moon ' .. build .. '/render_fileder.moon'

local _facets, facets = {}, {}
for i, file in ipairs(tup.glob '*$*') do _facets[file] = true end
for i, file in ipairs(tup.glob '*:*') do _facets[file] = true end
for i, file in ipairs(tup.glob '*->*') do _facets[file] = true end

for file in pairs(_facets) do facets += file end
table.sort(facets)

local inputs = ''
for i, file in ipairs(facets) do
  inputs = inputs .. " '" .. file .. "'"
end

facets += '<children>'
facets += root .. '/<modules>'

tup.rule(
  facets,
  '^ BNDL %d^ ' .. bundle .. ' ' .. root .. ' %d ' .. inputs .. ' -- %<children>',
  { '$bundle.lua', '../<children>' }
)

tup.rule(
  '$bundle.lua',
  '^ HTML %d^ ' .. render .. ' ' .. root,
  'index.html'
)