Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(api): cleanup api protobuf file autogeneration #438

Merged
merged 3 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions inventory/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@
# Copyright (C) 2022 Intel Corporation
# Copyright (c) 2022 Dell Inc, or its subsidiaries.

all:
rm -rf ./google
rm -rf ./v1/{autogen.md,gen}
mkdir -p ./v1/gen/{go,cpp,python,java}
all: buflint bufgen doc

docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}":/defs namely/protoc-all:1.51_2 --lint -d v1 -l go -o ./v1/gen/go/ --go-source-relative --with-gateway
docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}":/defs namely/protoc-all:1.51_2 --lint -d v1 -l cpp -o ./v1/gen/cpp/ --go-source-relative
docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}":/defs namely/protoc-all:1.51_2 --lint -d v1 -l python -o ./v1/gen/python/ --go-source-relative
docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}":/defs namely/protoc-all:1.51_2 --lint -d v1 -l java -o ./v1/gen/java/ --go-source-relative
doc:
rm -rf ./google
rm -f ./v1/autogen.md
mkdir -p ./v1

# protoc doesn't include the googleapis, so we have to get them here
# protoc doesn't include annotation and http googleapis, so we have to get them here
curl -kL https://github.com/googleapis/googleapis/archive/master.tar.gz | tar --strip=1 -zxvf - googleapis-master/google/api

mv google "${PWD}"/v1/
docker run --user=$$(id -u):$$(id -g) --rm --entrypoint=sh -v "${PWD}"/v1/:/out -w /out -v "${PWD}":/protos pseudomuto/protoc-gen-doc:1.5.1 -c "protoc -I /protos --doc_out=/out --doc_opt=markdown,autogen.md /protos/*.proto"

rm -rf "${PWD}"/google

docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}"/v1/:/out -v "${PWD}"/v1:/protos pseudomuto/protoc-gen-doc:1.5.1 --doc_opt=markdown,autogen.md
docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}"/v1/:/out -w /out --entrypoint=sh ghcr.io/docker-multiarch/google-api-linter:1.63.1 -c "api-linter /out/*.proto --output-format summary"
docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}"/v1/:/out -w /out --entrypoint=sh ghcr.io/docker-multiarch/google-api-linter:1.63.1 -c "api-linter /out/*.proto --output-format github --set-exit-status"
rm -rf "${PWD}"/v1/google
buflint:
docker run --rm -v "${PWD}":/out -w /out bufbuild/buf lint

bufgen:
docker run --rm -v "${PWD}/..":/base -v "${PWD}":/out -w /out msandersdell/bufbuild-go-gen:1.1.0 generate --template /base/buf.gen.yaml -o v1
File renamed without changes.
90 changes: 0 additions & 90 deletions inventory/v1/gen/cpp/inventory.grpc.pb.cc

This file was deleted.

Loading
Loading