-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
executable file
·133 lines (108 loc) · 2.97 KB
/
Justfile
File metadata and controls
executable file
·133 lines (108 loc) · 2.97 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/usr/bin/env -S just -f
set export
# Allow using docker or podman to build and run things:
DOCKER := env("DOCKER", "docker") + " "
BUILDER := "time " + DOCKER
BUILD := BUILDER + " build "
RUN := BUILDER + "run --rm -it"
TTY := RUN + ""
# Build container for WASM:
IMG_WASM := "hackbg/fadroma-simplicity:build"
VOL_WASM := " -v .:/build:rw "
RUN_WASM := RUN + VOL_WASM + IMG_WASM
TTY_WASM := TTY + VOL_WASM + IMG_WASM
# wasm-pack invocation
WASM_PACK := "time wasm-pack build --target web"
# Remove redundant files from build dir:
WASM_PKG := "rm -v pkg/package.json pkg/.gitignore pkg/README.md"
# Rebuild in debug mode and test
iterate:
just build
just test
# Rebuild in verbose debug mode and test
debug:
just build-debug
just test
# Rebuild in release mode and test
release:
just build-release
just test
# List tasks
list:
@just --list
# Show dependency tree
tree:
cargo tree --color=always --target=build32-unknown-unknown
# Report line counts.
cloc:
cloc \
--not-match-d=node_modules \
--not-match-d=target \
--not-match-d=dist \
--not-match-d=deps \
--not-match-d=.misc \
--not-match-d=.docs \
--not-match-d=.deno \
--not-match-d=coverage \
.
# Build development container images:
img:
@just build-img
@just test-img
# Build the container image in which WASMs are compiled.
build-img:
${BUILD} --target wasm -t "${IMG_WASM}" .
# Build the test image.
test-img:
${BUILD} --target test -t "${IMG_TEST}" .
# Open Bacon TUI to iterate on WASM modules in container.
bacon:
@just build-img
${TTY_WASM} "bacon -s"
# Compile dev build of WASM module in container.
build:
@just build-img
${RUN_WASM} "just build-wasm"
# Compile dev build of WASM module in container.
build-debug:
@just build-img
${RUN_WASM} "just build-wasm-debug"
# Compile release build of WASM module in container.
build-release:
@just build-img
${RUN_WASM} "just build-wasm-release"
# Build in dev mode (with stack trace)
build-wasm:
${WASM_PACK} --debug --no-opt .
${WASM_PKG}
@just build-inspect
# Build in dev mode (with stack trace and extra debug printing)
build-wasm-debug:
${WASM_PACK} --debug --no-opt . -F debug
${WASM_PKG}
@just build-inspect
# Build in release mode (with optimizations)
build-wasm-release:
${WASM_PACK} --release
${WASM_PKG}
@just build-inspect
# Open WASM build shell to iterate on WASM modules in container.
build-sh:
${TTY_WASM} bash
# Show imports and exports of built module
build-inspect:
wasm2wat pkg/fadroma_simf_bg.wasm | grep import
wasm2wat pkg/fadroma_simf_bg.wasm | grep export
# Test container:
IMG_TEST := "hackbg/fadroma-simplicity:test"
VOL_TEST := " -v .:/fadroma/platform/SimplicityHL:rw "
RUN_TEST := RUN + VOL_TEST + IMG_TEST
TTY_TEST := TTY + VOL_TEST + IMG_TEST
# Open test shell to iterate on WASM module wrapper in container.
test-sh:
@just test-img
${TTY_TEST} bash
# Run tests in container.
test:
@just test-img
${RUN_TEST} "cd platform/SimplicityHL/ && ./src/test.ts"