You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
987 B

proto: update proto generation to use buf (#7975) * Hard-code go_package option for .proto files Signed-off-by: Thane Thomson <connect@thanethomson.com> * Automatically relocate generated ABCI types after proto-gen Signed-off-by: Thane Thomson <connect@thanethomson.com> * Skip building gogoproto (i.e. only build our types) Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove unnecessary proto generation scripts Signed-off-by: Thane Thomson <connect@thanethomson.com> * Upgrade buf config from v1beta1 to v1 Signed-off-by: Thane Thomson <connect@thanethomson.com> * Add simple proto generation script Signed-off-by: Thane Thomson <connect@thanethomson.com> * Replace buf-based protobuf generation with simple protoc-based approach Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove custom buf-based Docker image generation config and Dockerfile Signed-off-by: Thane Thomson <connect@thanethomson.com> * Adopt Cosmos SDK's approach to Protobuf linting and breakage checking in CI Signed-off-by: Thane Thomson <connect@thanethomson.com> * Suppress command echo when running proto checks Signed-off-by: Thane Thomson <connect@thanethomson.com> * Fix proto-check workflow YAML indentation Signed-off-by: Thane Thomson <connect@thanethomson.com> * Restore proto-format target Signed-off-by: Thane Thomson <connect@thanethomson.com> * Replace custom BASH script with make equivalent Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove proto linting/breaking changes CI checks after discussion today Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove dangling reference to CI workflow that no longer exists Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update contributing guidelines relating to protos Signed-off-by: Thane Thomson <connect@thanethomson.com> * Use buf instead for generating protos Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove unused buf config for gogoprotobuf Signed-off-by: Thane Thomson <connect@thanethomson.com> * Add reminder for if we migrate fully to buf Signed-off-by: Thane Thomson <connect@thanethomson.com> * Restore protopackage script for #8065 Signed-off-by: Thane Thomson <connect@thanethomson.com> * Fix permissions on protopackage script Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update contributing guidelines to show building of protos using buf Signed-off-by: Thane Thomson <connect@thanethomson.com> * Fix breaking changes check and add disclaimer Signed-off-by: Thane Thomson <connect@thanethomson.com> * Expand on contributing guidelines for clarity Signed-off-by: Thane Thomson <connect@thanethomson.com> * Re-remove old proto workflows Signed-off-by: Thane Thomson <connect@thanethomson.com> * Add buf-based proto linting workflow in CI Signed-off-by: Thane Thomson <connect@thanethomson.com> * Superficially reorder proto targets Signed-off-by: Thane Thomson <connect@thanethomson.com> * Fix proto lints Signed-off-by: Thane Thomson <connect@thanethomson.com> * Fix GA workflow YAML indentation Signed-off-by: Thane Thomson <connect@thanethomson.com> * Temporarily use forked version of mlc Use forked version of markdown-link-check until https://github.com/gaurav-nelson/github-action-markdown-link-check/pull/126 lands. Signed-off-by: Thane Thomson <connect@thanethomson.com> * Temporarily disable markdown link checker Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove gogo protos - superseded by version from buf registry Signed-off-by: Thane Thomson <connect@thanethomson.com>
2 years ago
  1. #!/usr/bin/sh
  2. set -eo pipefail
  3. # This script appends the "option go_package" proto option to the file located at $FNAME.
  4. # This option specifies what the package will be named when imported by other packages.
  5. # This option is not directly included in the proto files to allow the files to more easily
  6. # be hosted in github.com/tendermint/spec and shared between other repos.
  7. # If the option is already specified in the file, it will be replaced using the
  8. # arguments passed to this script.
  9. FNAME="${1:?missing required .proto filename}"
  10. MODNAME=$(echo $2| sed 's/\//\\\//g')
  11. PACKAGE="$(dirname $FNAME | sed 's/^\.\/\(.*\)/\1/g' | sed 's/\//\\\//g')"
  12. if [[ ! -z "$3" ]]; then
  13. PACKAGE="$(echo $3 | sed 's/\//\\\//g')"
  14. fi
  15. if ! grep -q 'option\s\+go_package\s\+=\s\+.*;' $FNAME; then
  16. sed -i "s/\(package tendermint.*\)/\1\n\noption go_package = \"$MODNAME\/$PACKAGE\";/g" $FNAME
  17. else
  18. sed -i "s/option\s\+go_package\s\+=\s\+.*;/option go_package = \"$MODNAME\/$PACKAGE\";/g" $FNAME
  19. fi