-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJustfile
68 lines (55 loc) · 1.61 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
set quiet
set dotenv-load
default: lang-c lang-cpp
dependencies: env image pvme polkatool
env:
#!/usr/bin/env sh
if [ ! -f .env ]; then
echo "Please run either 'just docker' or 'just podman' first"
exit 1
fi
# Check if the docker iamge is present
image:
#!/usr/bin/env sh
if ! $DOCKER inspect --type=image pvm > /dev/null 2>&1; then
echo "Docker image not found. Building..."
$DOCKER build -t pvm .
fi
# Set docker as the preferred container runtime
docker:
echo "DOCKER=docker" > .env
# Set podman as the preferred container runtime
podman:
echo "DOCKER=podman" > .env
# Recipe for installing pvme
pvme:
#!/usr/bin/env bash
if ! command -v pvme > /dev/null 2>&1; then
cargo install --locked --path pvme
fi
# Recipe for installing polkatool
polkatool:
#!/usr/bin/env bash
NEEDS_INSTALL=0
# Check if polkatool is installed
if ! command -v polkatool > /dev/null 2>&1; then
NEEDS_INSTALL=1
else
# Check that we have version 0.10.x installed
VERSION=$(polkatool --version | cut -d' ' -f2)
read -r MAJOR MINOR PATCH <<< $(echo $VERSION | tr '.' ' ')
if [ $MAJOR -ne 0 ] || [ $MINOR -ne 15 ]; then
NEEDS_INSTALL=1
fi
fi
if [ $NEEDS_INSTALL -eq 1 ]; then
echo "Installing polkatool version 0.15.x"
cargo install --force --git https://github.com/koute/polkavm --rev 5f9681bd2bced634f9249bb3836f59e530b1918c polkatool
fi
lang-c: dependencies
just lang-c/
lang-cpp: dependencies
just lang-cpp/
clean:
just lang-c/clean
just lang-cpp/clean