Skip to content

Commit

Permalink
Merge pull request #13062 from nate-double-u/13050-genproto-updates
Browse files Browse the repository at this point in the history
updating scripts/genproto.sh
  • Loading branch information
ptabor committed Jun 2, 2021
2 parents 573e055 + 9e4dd4d commit bd475d8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
39 changes: 31 additions & 8 deletions scripts/genproto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
---
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}

run rm -rf Documentation/dev-guide/api_concurrency_reference_v3.md
# 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
Expand Down

0 comments on commit bd475d8

Please sign in to comment.