chirpstack/api/python/Makefile
Orne Brocaar d170c7dd79 api: Remove generated API files from repo + update build.
All these files can be generated using the `make api` command and there
is no real need to commit these into the repo. Only the api/go files
need to be comitted of how the Go import system works.

This also updates the Rust, Go, JS and gRPC-web (JS) code generation and
UI build to use the nix-shell environment instead of using Docker.
2024-04-01 14:27:15 +01:00

50 lines
1.9 KiB
Makefile
Vendored

.PHONY: requirements common gw api integration stream
PROTOC := python -m grpc_tools.protoc
PROTOC_ARGS := -I=proto --python_out=src --grpc_python_out=src --pyi_out=src
PACKAGE_NAME := import \"chirpstack-api/
all: requirements pre-build common gw api integration stream
requirements:
pip install grpcio-tools
# See: https://github.com/protocolbuffers/protobuf/issues/7061
pre-build:
rm -rf proto
mkdir -p proto/chirpstack-api
cp -r ../proto/* proto/chirpstack-api/
mv proto/chirpstack-api/google proto/google
sed -i 's@^import "common/@$(PACKAGE_NAME)common/@g' `find proto/chirpstack-api -type f -name "*.proto*"`
sed -i 's@^import "gw/@$(PACKAGE_NAME)gw/@g' `find proto/chirpstack-api -type f -name "*.proto*"`
sed -i 's@^import "api/@$(PACKAGE_NAME)api/@g' `find proto/chirpstack-api -type f -name "*.proto*"`
mkdir -p src
common:
$(PROTOC) $(PROTOC_ARGS) chirpstack-api/common/common.proto
gw:
$(PROTOC) $(PROTOC_ARGS) chirpstack-api/gw/gw.proto
api:
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/api/internal.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/api/user.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/api/tenant.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/api/application.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/api/device_profile.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/api/device_profile_template.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/api/device.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/api/gateway.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/api/multicast_group.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/api/relay.proto
integration:
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/integration/integration.proto
stream:
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/stream/meta.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/stream/frame.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/stream/api_request.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/stream/backend_interfaces.proto