-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKnitfile
50 lines (39 loc) · 1.11 KB
/
Knitfile
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use(require("knit"))
addpath(".")
local source = {
rs = glob("core/wasm/*/*.rs"),
ts = glob("core/wasm/*/*.ts"),
s = glob("core/wasm/*/*.s"),
wat = glob("core/wasm/*/*.s.wat"),
pom = glob("core/regex/*.pom"),
}
-- regex
local regex = { js = extrepl(source.pom, ".pom", ".js") }
--
-- wasm
local ffi = { rs = extrepl(source.s, ".s", ".rs") }
local types = { rs = glob("core/wasm/types/*.rs") }
local wasm = {}
wasm.source = { rs = filterout(filterout(source.rs, ffi.rs), types.rs) }
wasm.rs = extrepl(wasm.source.rs, ".rs", ".wasm")
wasm.ts = extrepl(source.ts, ".ts", ".wasm")
local wat = {
rs = suffix(wasm.rs, ".wat"),
ts = suffix(wasm.ts, ".wat"),
}
--
return b{
$ all:V: all-js all-wasm
$ manifest:V: rust-project.json Cargo.toml
$ %.br: %
brotli $input
include("core/regex/Knitfile"),
$ all-js:V: $(regex.js)
include("core/wasm/Knitfile"),
$ all-wasm:V: $(wasm.rs) $(wasm.ts)
$ all-wat:V: $(wat.rs) $(wat.ts)
$ rust-project.json: $(source.rs)
echo '$(require("rust-project")(inputs))' > $output
$ Cargo.toml: $(wasm.source.rs)
echo '$(require("Cargo")(inputs))' > $output
}