-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
70 lines (56 loc) · 1.39 KB
/
Makefile
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
.PHONY: tests app proto
####
# Environment
####
build-env:
uv sync
run: proto electron-proto
uv run python launch.py
####
# Project
####
run-server: proto
PYTHONPATH=$PYTHONPATH:.:./proto/generated uv run server/grpc_service.py
run-app: electron-proto
cd client && npm start
proto: clean-proto
uv run -m grpc_tools.protoc \
-Iproto \
--python_out=proto/generated \
--grpc_python_out=proto/generated \
proto/chat.proto
linting:
uv run ruff check server
uv run ruff check tests
test-server: proto
uv run pytest --durations=0 --durations-min=0.1 tests/test_grpc_service.py
unittests: proto
uv run pytest --durations=0 --durations-min=0.1 tests
tests: linting unittests
clean-proto:
rm -rf proto/generated/chat_pb2.py
rm -rf proto/generated/chat_pb2_grpc.py
rm -rf client/proto/generated/chat_pb.js
rm -rf client/proto/generated/chat_grpc.js
clean: clean-proto
rm -rf .venv
rm -rf .ruff_cache
rm -rf server/__pycache__
rm -rf tests/__pycache__
####
# Electron
####
electron-setup: electron-clean
cd client && npm install
electron-proto: proto
mkdir -p client/proto/generated
cp proto/chat.proto client/proto/
cd client && \
npx grpc_tools_node_protoc \
--js_out=import_style=commonjs,binary:./proto/generated \
--grpc_out=grpc_js:./proto/generated \
--proto_path=./proto \
./proto/chat.proto
electron-clean:
rm -rf client/proto/generated/*
rm -f client/proto/chat.proto