updating scripts/genproto.sh

Changing API-reference generator

- matching changes mentioned in https://github.com/etcd-io/website/issues/330
- generating page frontmater
- updating .gitignore

Signed-off-by: Nate W <4453979+nate-double-u@users.noreply.github.com>
This commit is contained in:
Nate W 2021-05-31 13:02:28 -07:00
parent c7cbc6befa
commit 9e4dd4dc4e
2 changed files with 33 additions and 8 deletions

2
.gitignore vendored
View File

@ -21,3 +21,5 @@ hack/tls-setup/certs
*.tmp
*.bak
.gobincache/
/Documentation/dev-guide/api_reference_v3.md
/Documentation/dev-guide/api_concurrency_reference_v3.md

View File

@ -92,23 +92,46 @@ done
log_callout -e "\\nRunning swagger ..."
run_go_tool github.com/hexfusion/schwag -input=Documentation/dev-guide/apispec/swagger/rpc.swagger.json
if [ "$1" != "--skip-protodoc" ]; then
log_callout "protodoc is auto-generating grpc API reference documentation..."
run rm -rf Documentation/dev-guide/api_reference_v3.md
# API reference
API_REFERENCE_FILE="Documentation/dev-guide/api_reference_v3.md"
run rm -rf ${API_REFERENCE_FILE}
run_go_tool go.etcd.io/protodoc --directories="api/etcdserverpb=service_message,api/mvccpb=service_message,server/lease/leasepb=service_message,api/authpb=service_message" \
--title="etcd API Reference" \
--output="Documentation/dev-guide/api_reference_v3.md" \
--output="${API_REFERENCE_FILE}" \
--message-only-from-this-file="api/etcdserverpb/rpc.proto" \
--disclaimer="This is a generated documentation. Please read the proto files for more." || exit 2
--disclaimer="---
title: API reference
---
run rm -rf Documentation/dev-guide/api_concurrency_reference_v3.md
This API reference is autogenerated from the named \`.proto\` files." || exit 2
# remove the first 3 lines of the doc as an empty --title adds '### ' to the top of the file.
run sed -i -e 1,3d ${API_REFERENCE_FILE}
# API reference: concurrency
API_REFERENCE_CONCURRENCY_FILE="Documentation/dev-guide/api_concurrency_reference_v3.md"
run rm -rf ${API_REFERENCE_CONCURRENCY_FILE}
run_go_tool go.etcd.io/protodoc --directories="server/etcdserver/api/v3lock/v3lockpb=service_message,server/etcdserver/api/v3election/v3electionpb=service_message,api/mvccpb=service_message" \
--title="etcd concurrency API Reference" \
--output="Documentation/dev-guide/api_concurrency_reference_v3.md" \
--disclaimer="This is a generated documentation. Please read the proto files for more." || exit 2
--output="${API_REFERENCE_CONCURRENCY_FILE}" \
--disclaimer="---
title: \"API reference: concurrency\"
---
This API reference is autogenerated from the named \`.proto\` files." || exit 2
# remove the first 3 lines of the doc as an empty --title adds '### ' to the top of the file.
run sed -i -e 1,3d ${API_REFERENCE_CONCURRENCY_FILE}
log_success "protodoc is finished."
log_warning -e "\\nThe API references have NOT been automatically published on the website."
log_success -e "\\nTo publish the API references, copy the following files"
log_success " - ${API_REFERENCE_FILE}"
log_success " - ${API_REFERENCE_CONCURRENCY_FILE}"
log_success "to the etcd-io/website repo under the /content/en/docs/next/dev-guide/ folder."
log_success "(https://github.com/etcd-io/website/tree/main/content/en/docs/next/dev-guide)"
else
log_warning "skipping grpc API reference document auto-generation..."
fi