Skip to content

Commit

Permalink
tools: clone proto files from spec (#6976)
Browse files Browse the repository at this point in the history
## Description

clone proto files from spec in order to have them in a single location

closes tendermint/spec#343
  • Loading branch information
tac0turtle authored and evan-forbes committed Feb 2, 2022
1 parent 86b292b commit 65b93eb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Special thanks to external contributors on this release:
- [rpc] Remove the deprecated gRPC interface to the RPC service (@creachadair).

- Apps
- [proto/tendermint] \#6976 Remove core protobuf files in favor of only housing them in the [tendermint/spec](https://github.com/tendermint/spec) repository.

- P2P Protocol

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ We use [Protocol Buffers](https://developers.google.com/protocol-buffers) along

For linting, checking breaking changes and generating proto stubs, we use [buf](https://buf.build/). If you would like to run linting and check if the changes you have made are breaking then you will need to have docker running locally. Then the linting cmd will be `make proto-lint` and the breaking changes check will be `make proto-check-breaking`.

We use [Docker](https://www.docker.com/) to generate the protobuf stubs. To generate the stubs yourself, make sure docker is running then run `make proto-gen`.
We use [Docker](https://www.docker.com/) to generate the protobuf stubs. To generate the stubs yourself, make sure docker is running then run `make proto-gen`. This command uses the spec repo to get the necessary protobuf files for generating the go code. If you are modifying the proto files manually for changes in the core data structures, you will need to clone them into the go repo and comment out lines 22-37 of the file `./scripts/protocgen.sh`.

### Visual Studio Code

Expand Down
29 changes: 24 additions & 5 deletions scripts/protocgen.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
#!/usr/bin/env bash

# should be executed at the root directory of the project
VERS=0.7.1

set -eo pipefail

git clone https://github.com/celestiaorg/spec
# Edit this line to clone your branch, if you are modifying protobuf files
curl -qL "https://github.com/tendermint/spec/archive/refs/tags/v${VERS}.tar.gz" | tar -xjf - spec-"$VERS"/proto/

cp -r spec/proto/tendermint proto
cp -r ./spec-"$VERS"/proto/tendermint/** ./proto/tendermint

buf generate --path proto/tendermint

mv ./proto/tendermint/abci/types.pb.go ./abci/types

find proto/tendermint/ -name "*.proto" -exec rm -rf {} \;
echo "proto files have been generated"

echo "removing copied files"

rm -rf ./proto/tendermint/abci/types.proto
rm -rf ./proto/tendermint/blocksync/types.proto
rm -rf ./proto/tendermint/consensus/types.proto
rm -rf ./proto/tendermint/mempool/types.proto
rm -rf ./proto/tendermint/p2p/types.proto
rm -rf ./proto/tendermint/p2p/conn.proto
rm -rf ./proto/tendermint/p2p/pex.proto
rm -rf ./proto/tendermint/statesync/types.proto
rm -rf ./proto/tendermint/types/block.proto
rm -rf ./proto/tendermint/types/evidence.proto
rm -rf ./proto/tendermint/types/params.proto
rm -rf ./proto/tendermint/types/types.proto
rm -rf ./proto/tendermint/types/validator.proto
rm -rf ./proto/tendermint/version/version.proto

rm -rf spec
rm -rf ./spec-"$VERS"

0 comments on commit 65b93eb

Please sign in to comment.