-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
78 lines (66 loc) · 2.07 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
71
72
73
74
75
76
77
78
# Makefile assumes that direnv is active, or that pip/python on PATH
# is what you want to use.
# unstable protos are only included in local development and not part of release packages
SENTRY_PROTOS_BUILD_UNSTABLE := 1
.PHONY: update-venv
update-venv:
pip install -r requirements.txt
# Python client targets
.PHONY: build-py
build-py:
pip install -r requirements.txt
SENTRY_PROTOS_BUILD_UNSTABLE=$(SENTRY_PROTOS_BUILD_UNSTABLE) python py/generate.py
.PHONY: package-py
package-py:
make build-py SENTRY_PROTO_BUILD_UNSTABLE=0
cd py && python -m build
.PHONY: clean-py
clean-py:
rm -rf ./py/dist
rm -rf ./py/sentry_protos
rm -rf ./py/sentry_protos.egg-info
# Rust client targets
.PHONY: build-rust
build-rust:
SENTRY_PROTOS_BUILD_UNSTABLE=$(SENTRY_PROTOS_BUILD_UNSTABLE) cd rust && cargo build
.PHONY: clean-rust
clean-rust:
cd rust && cargo clean
repodir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
.PHONY: update-vendor
update-vendor:
cd $$(mktemp -d) && \
git clone -n --depth=1 --filter=tree:0 \
https://github.com/protocolbuffers/protobuf && \
cd protobuf && git sparse-checkout set --no-cone src/google/protobuf && \
git checkout && rm -rf .git && \
find . '(' ! -name '*.proto' -a ! -name '*.md' ')' -delete && \
find . -name '*unittest*' -delete && \
find . -name 'test_*' -delete && \
rm -rf src/google/protobuf/compiler && \
find . && \
rm -rf $(repodir)proto/google && \
mv src/google $(repodir)proto/
.PHONY: build
build: build-py build-rust
# installs protoc if not already installed
.PHONY: ensure-protoc
ensure-protoc:
@which protoc >/dev/null 2>&1 || ( \
echo "Installing protoc..." && \
if [ "$$(uname)" = "Darwin" ]; then \
brew install protobuf; \
else \
echo "Error: Automatic protoc installation not supported on this OS, please install it manually"; \
exit 1; \
fi \
)
.PHONY: docs
docs: ensure-protoc
pip install sabledocs
protoc ./proto/sentry_protos/*/*/*.proto -I ./proto/ -o ./docs/descriptor.pb --include_source_info
cd docs && sabledocs
.PHONY: test-py
test-py:
cd py && pip install -e .
pytest py/tests/