2022-10-31 16:23:55 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latest
|
|
|
|
|
|
|
|
PROJECT_BASE=$(git rev-parse --show-toplevel)
|
|
|
|
|
|
|
|
# change to proto directory
|
|
|
|
cd "${PROJECT_BASE}"/protobufs || exit
|
|
|
|
|
|
|
|
git checkout master
|
|
|
|
|
|
|
|
if git submodule status | grep -q '^[-]|^[+]' ; then \
|
2022-11-02 11:46:54 -07:00
|
|
|
echo "INFO: Re-initializing git submodules..."; \
|
2022-10-31 16:23:55 -07:00
|
|
|
git submodule update --init --recursive; \
|
|
|
|
else \
|
|
|
|
echo "INFO: Updating git submodules..."; \
|
|
|
|
git pull --recurse-submodules; \
|
|
|
|
git submodule update --remote --recursive
|
|
|
|
fi
|
|
|
|
|
|
|
|
# remove old generated protos
|
|
|
|
rm -rf "${PROJECT_BASE}/docs/developers/Protobufs/*"
|
|
|
|
|
2022-11-02 11:46:54 -07:00
|
|
|
protoc --doc_opt="${PROJECT_BASE}/protobuf.tmpl,protobuf-api.mdx" --doc_out="${PROJECT_BASE}/docs/development/" --proto_path="${PROJECT_BASE}/protobufs" *.proto
|