Skip to content

Commit

Permalink
add gen proto script (chaos-mesh#519)
Browse files Browse the repository at this point in the history
  • Loading branch information
yeya24 authored May 18, 2020
1 parent ce7d7dc commit f90a4ef
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,12 @@ generate: controller-gen
yaml: manifests ensure-kustomize
$(KUSTOMIZE_BIN) build config/default > manifests/crd.yaml

# Generate Go files from Chaos Mesh proto files.
proto:
hack/genproto.sh

update-install-script:
./hack/update_install_script.sh
hack/update_install_script.sh

e2e-build:
$(GO) build -trimpath -o test/image/e2e/bin/ginkgo github.com/onsi/ginkgo/ginkgo
Expand Down Expand Up @@ -265,5 +269,5 @@ install-local-coverage-tools:
.PHONY: all build test install manifests groupimports fmt vet tidy image \
binary docker-push lint generate controller-gen yaml \
manager chaosfs chaosdaemon chaos-server ensure-all \
dashboard dashboard-server-frontend \
gosec-scan
dashboard dashboard-server-frontend gosec-scan \
proto
21 changes: 21 additions & 0 deletions hack/genproto.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
#
# Generate all protobuf bindings.
# Run from repository root.
set -eu

PROTOC_BIN=${PROTOC_BIN:-protoc}

if ! [[ "$0" =~ "hack/genproto.sh" ]]; then
echo "must be run from repository root"
exit 255
fi

DIRS="pkg/chaosdaemon/pb pkg/chaosfs/pb"

echo "generating code"
for dir in ${DIRS}; do
pushd ${dir}
${PROTOC_BIN} --go_out=plugins=grpc:. -I=. *.proto
popd
done

0 comments on commit f90a4ef

Please sign in to comment.