-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakefile
More file actions
80 lines (71 loc) · 1.85 KB
/
Copy pathmakefile
File metadata and controls
80 lines (71 loc) · 1.85 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
.PHONY: clean install build generate_buf format clean_buf_out
# Detect platform
IS_WINDOWS := $(findstring Windows_NT, $(OS))
ifeq ($(IS_WINDOWS), Windows_NT)
RM = rmdir /S /Q
DEL = del /F /Q
NULL = nul
SHELL := cmd
CD = cd
else
RM = rm -rf
NULL = /dev/null
SHELL := /bin/bash
CD = cd
endif
# Remove generated protobuf directories
clean_buf_out:
@$(RM) synapse_net/src/synapse_net/proto/ 2>$(NULL) || true
@$(RM) synapse_ui/src/proto/ 2>$(NULL) || true
# General clean
clean:
@$(RM) build/ dist/ .pytest_cache/ synapse_ui/out/ 2>$(NULL) || true
@$(MAKE) clean_buf_out
# Install Python package locally
install:
@echo Building UI...
@$(CD) synapse_ui && npm run build
@$(CD) ..
@echo Installing Synapse Package...
pip install .
# Generate protobuf code with buf
generate_buf:
@$(MAKE) clean_buf_out
@$(CD) synapse_net/proto && \
buf lint && \
buf format -w && \
buf generate --template buf-ts.yaml && \
buf generate --template buf-python.yaml && \
$(CD) .. &\
$(CD) .. &\
make install
license:
shopt -s globstar; python3 -m reuse annotate --license GPL-3.0-or-later --copyright "Dan Peled" **/*.py
format:
make license
@echo Ruff format...
@python3 -m ruff format . >$(NULL) 2>&1 || echo ruff format failed
@echo Isort format...
@python3 -m isort . >$(NULL) 2>&1 || echo isort failed
@echo Synapse UI format...
@$(CD) synapse_ui && npm run format
@echo Synapse Manager format...
@$(CD) ..
@$(CD) synapse_manager && npm run format
@echo ProtoBuf format...
@$(CD) ..
@$(CD) synapse_net/proto && \
buf format -w
@cd ..
@echo SynapseLib SpotlessApply
@${CD} synapse_lib && \
./gradlew spotlessApply
test:
@echo Reinstalling Synapse Runtime...
@pip install .
@echo Starting Tests...
@python3 -m pytest . --ignore=synapse_lib/
# Build Python and UI
build:
make install
python3 setup.py sdist bdist_wheel