forked from ineiti/fledger
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
130 lines (106 loc) · 3.75 KB
/
Makefile
File metadata and controls
130 lines (106 loc) · 3.75 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
CARGOS := cli/{fledger,flsignal} flarch flbrowser flcrypto flmacro \
flmodules flnode test/{signal-fledger,fledger-nodejs,webrtc-libc-wasm/{libc,wasm}} \
examples/ping-pong/{shared,libc,wasm}
CARGOS_NOWASM := cli/{fledger,flsignal} flarch flbrowser flcrypto flmacro \
flmodules flnode test/{signal-fledger,webrtc-libc-wasm/libc} \
examples/ping-pong/{shared,libc}
CARGO_LOCKS := . test/{fledger-nodejs,webrtc-libc-wasm/wasm} flbrowser examples/ping-pong/wasm
MAKE_TESTS := examples/ping-pong test/webrtc-libc-wasm
CRATES := flcrypto flmacro flarch flmodules flnode
SHELL := /bin/bash
PKILL = @/bin/ps aux | grep "$1" | egrep -v "(grep|vscode|rust-analyzer)" | awk '{print $$2}' | xargs -r kill
PUBLISH = --token $$CARGO_REGISTRY_TOKEN
FLEDGER = cargo run --bin fledger -- --config fledger/test0$1 --name Local0$1 \
--log-dht-storage -s ws://localhost:8765 --disable-turn-stun
cargo_check:
set -e; \
for c in ${CARGO_LOCKS}; do \
echo Checking $$c; \
( cd $$c && cargo check --tests ) || exit 1; \
done
cargo_test:
set -e; \
for c in ${CARGO_LOCKS}; do \
echo Checking $$c; \
( cd $$c && cargo test ) || exit 1; \
done
make_test:
echo "Tests which need to be inspected manually. But still run them in github workflows."
for c in ${MAKE_TESTS}; do \
( cd $$c && make test ) \
done
cargo_update:
for c in ${CARGO_LOCKS}; do \
echo Updating $$c; \
(cd $$c && cargo update ); \
done
cargo_clean:
for c in ${CARGO_LOCKS}; do \
echo Cleaning $$c; \
(cd $$c && cargo clean ); \
done
cargo_build:
set -e; \
for c in ${CARGO_LOCKS}; do \
echo Building $$c; \
(cd $$c && cargo build --tests ) || exit 1; \
done
cargo_unused:
for cargo in ${CARGOS_NOWASM}; do \
echo Checking for unused crates in $$cargo; \
(cd $$(dirname $$cargo) && cargo +nightly udeps -q --all-targets ); \
done
publish_dry: PUBLISH = --dry-run
publish_dry: publish
publish:
set -e; \
for crate in ${CRATES}; do \
if grep -q '"\*"' $$crate/Cargo.toml; then \
echo "Remove wildcard version from $$crate"; \
exit 1; \
fi; \
CRATE_VERSION=$$(cargo search $$crate | grep "^$$crate " | sed -e "s/.*= \"\(.*\)\".*/\1/"); \
CARGO_VERSION=$$(grep "^version" $$crate/Cargo.toml | head -n 1 | sed -e "s/.*\"\(.*\)\".*/\1/"); \
if [[ "$$CRATE_VERSION" != "$$CARGO_VERSION" ]]; then \
echo "Publishing crate $$crate"; \
cargo publish ${PUBLISH} --manifest-path $$crate/Cargo.toml; \
fi; \
done
update_version:
echo "pub const VERSION_STRING: &str = \"$$( date +%Y-%m-%d_%H:%M )::$$( git rev-parse --short HEAD )\";" > flnode/src/version.rs
kill:
$(call PKILL,flsignal)
$(call PKILL,fledger)
$(call PKILL,trunk serve)
build_cli:
cd cli && cargo build -p fledger && cargo build -p flsignal
build_cli_release:
cd cli && cargo build --release -p fledger && cargo build --release -p flsignal
build_web_release:
cd flbrowser && trunk build --release
build_web:
cd flbrowser && trunk build
build_servers: build_cli build_web
build_local_web:
cd flbrowser && trunk build --features local
build_local: build_local_web build_cli
serve_two: kill build_cli
( cd cli && cargo run --bin flsignal -- -v ) &
sleep 4
( cd cli && ( $(call FLEDGER,1) & $(call FLEDGER,2) & ) )
serve_local: kill build_local_web serve_two
cd flbrowser && RUST_BACKTRACE=1 trunk serve --features local -w . -w ../flmodules &
sleep 2
open http://localhost:8080
create_local_realm:
cd cli/fledger && cargo run -- -c test03 -n Local03 -s ws://localhost:8765 --disable-turn-stun realm create danu_realm
docker_dev:
for cli in fledger flsignal; do \
docker build --target $$cli --platform linux/amd64 -t fledgre/$$cli:dev . -f Dockerfile.dev --progress plain; \
docker push fledgre/$$cli:dev; \
done
clean:
for c in ${CARGOS}; do \
echo "Cleaning $$c"; \
( cd $$c && cargo clean ) ; \
done