From 9e4dd4dc4ec25a447719d4502bdbd240f9ad2f8b Mon Sep 17 00:00:00 2001 From: Nate W <4453979+nate-double-u@users.noreply.github.com> Date: Mon, 31 May 2021 13:02:28 -0700 Subject: [PATCH] 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> --- .gitignore | 2 ++ scripts/genproto.sh | 39 +++++++++++++++++++++++++++++++-------- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 75dbff8e8..dbb48c6e1 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file diff --git a/scripts/genproto.sh b/scripts/genproto.sh index 8b09b6dab..658e5a4da 100755 --- a/scripts/genproto.sh +++ b/scripts/genproto.sh @@ -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