-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
91 lines (81 loc) · 2.52 KB
/
justfile
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
amvm TARGET *args='':
@{{ justfile_directory() }}/target/{{TARGET}}/amvm {{args}}
compile TARGET OUTPUT="build.amb":
cargo run -- compile {{TARGET}} {{OUTPUT}}
@echo "Visualize output with hexyl"
@hexyl {{OUTPUT}}
jit TARGET:
cargo run -- jit {{TARGET}}
jit-ex TARGET:
just jit examples/{{TARGET}}
test TARGET OUTPUT="build.amb":
cargo build
@just amvm debug compile {{TARGET}} {{OUTPUT}}; \
if [[ $? = "0" ]]; then \
echo -e "\x1b[32m✓ Build {{TARGET}}\x1b[0m"; \
else \
echo -e "\x1b[33m╳ Build {{TARGET}} ($?)\x1b[0m"; \
exit 1; \
fi;
@hexyl {{OUTPUT}}
@just amvm debug run {{OUTPUT}}; \
if [[ $? = "0" ]]; then \
echo -e "\x1b[32m✓ Run {{TARGET}}\x1b[0m"; \
else \
echo -e "\x1b[33m╳ Run {{TARGET}} ($?)\x1b[0m"; \
fi;
[unix]
test-all-examples:
cargo build --release
@for f in examples/*.aml3; do \
just amvm release compile $f build.amb; \
if [[ $? = "0" ]]; then \
just amvm release inspect build.amb > /dev/null; \
if [[ $? = "0" ]]; then \
echo -e "\x1b[32m✓ $f\x1b[0m"; \
else \
echo -e "\x1b[33m╳ $f ($?)\x1b[0m"; \
fi; \
else \
echo -e "\x1b[33m╳ $f ($?)\x1b[0m"; \
fi; \
done;
[unix]
run-all-examples *args='.skip.aml3':
@echo -e "\x1b[1mSKIPPING: \x1b[31m{{ args }}\x1b[0m"
cargo build --release
@for f in examples/*.aml3; do \
just should-be-ignored $f {{args}} &> /dev/null; \
if [[ $? = "1" ]]; then \
echo -e "\x1b[2m - Skipping $f\x1b[0m"; \
else \
just amvm release compile $f build.amb; \
if [[ $? = "0" ]]; then \
just amvm release inspect build.amb > /dev/null; \
if [[ $? = "0" ]]; then \
if [[ $f =~ ".fail" ]]; then \
just amvm release run build.amb &> /dev/null; \
if [[ $? = "1" ]]; then \
echo -e "\x1b[2;32m ✓ Tested $f\x1b[0m"; \
else \
echo -e "\x1b[33m ╳ Test failed $f ($?)\x1b[0m"; \
fi; \
else \
just amvm release run build.amb > /dev/null; \
if [[ $? = "0" ]]; then \
echo -e "\x1b[2;32m ✓ Tested $f\x1b[0m"; \
else \
echo -e "\x1b[33m ╳ Test failed $f ($?)\x1b[0m"; \
fi; \
fi; \
else \
echo -e "\x1b[33m ╳ Build failed $f ($?)\x1b[0m"; \
fi; \
else \
echo -e "\x1b[33m ╳ Build failed $f ($?)\x1b[0m"; \
fi; \
fi; \
done;
[unix]
should-be-ignored TARGET *rules='':
@bash -c 'f=$1; shift; while (( "$#" )); do if [[ $f =~ "$1" ]]; then exit 1; fi; shift; done' -- {{ TARGET }} {{ rules }}