build: optimize proto-builder (#16343)
This commit is contained in:
parent
cac7e89e1d
commit
6453234073
2
.github/workflows/proto-registry.yml
vendored
2
.github/workflows/proto-registry.yml
vendored
@ -13,7 +13,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: bufbuild/buf-setup-action@v1.19.0
|
||||
- uses: bufbuild/buf-setup-action@v1.20.0
|
||||
- uses: bufbuild/buf-push-action@v1
|
||||
with:
|
||||
input: "proto"
|
||||
|
||||
4
.github/workflows/proto.yml
vendored
4
.github/workflows/proto.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: bufbuild/buf-setup-action@v1.19.0
|
||||
- uses: bufbuild/buf-setup-action@v1.20.0
|
||||
- uses: bufbuild/buf-lint-action@v1
|
||||
with:
|
||||
input: "proto"
|
||||
@ -24,7 +24,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: bufbuild/buf-setup-action@v1.19.0
|
||||
- uses: bufbuild/buf-setup-action@v1.20.0
|
||||
- uses: bufbuild/buf-breaking-action@v1
|
||||
with:
|
||||
input: "proto"
|
||||
|
||||
2
Makefile
2
Makefile
@ -398,7 +398,7 @@ lint-fix:
|
||||
### Protobuf ###
|
||||
###############################################################################
|
||||
|
||||
protoVer=0.13.1
|
||||
protoVer=0.13.2
|
||||
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
|
||||
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)
|
||||
|
||||
|
||||
@ -5,7 +5,9 @@ deps:
|
||||
owner: cosmos
|
||||
repository: cosmos-proto
|
||||
commit: 1935555c206d4afb9e94615dfd0fad31
|
||||
digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377
|
||||
- remote: buf.build
|
||||
owner: cosmos
|
||||
repository: gogo-proto
|
||||
commit: 6652e3443c3b4504bb3bf82e73a7e409
|
||||
commit: 5e5b9fdd01804356895f8f79a6f1ddc1
|
||||
digest: shake256:0b85da49e2e5f9ebc4806eae058e2f56096ff3b1c59d1fb7c190413dd15f45dd456f0b69ced9059341c80795d2b6c943de15b120a9e0308b499e43e4b5fc2952
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# docker build --pull --rm -f "contrib/devtools/Dockerfile" -t cosmossdk-proto:latest "contrib/devtools"
|
||||
# docker run --rm -v $(pwd):/workspace --workdir /workspace cosmossdk-proto sh ./scripts/protocgen.sh
|
||||
|
||||
FROM bufbuild/buf:1.19.0 as BUILDER
|
||||
FROM bufbuild/buf:1.20.0 as BUILDER
|
||||
FROM golang:1.20-alpine
|
||||
|
||||
RUN apk add --no-cache \
|
||||
@ -27,7 +27,8 @@ RUN go install github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest &&
|
||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GOLANG_PROTOBUF_VERSION} && \
|
||||
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v${GRPC_GATEWAY_VERSION} \
|
||||
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v${GRPC_GATEWAY_VERSION} && \
|
||||
go install cosmossdk.io/orm/cmd/protoc-gen-go-cosmos-orm@v1.0.0-beta.3
|
||||
go install cosmossdk.io/orm/cmd/protoc-gen-go-cosmos-orm@v1.0.0-beta.3 && \
|
||||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||
|
||||
# install all gogo protobuf binaries
|
||||
RUN git clone https://github.com/cosmos/gogoproto.git; \
|
||||
|
||||
@ -5,11 +5,14 @@ deps:
|
||||
owner: cosmos
|
||||
repository: cosmos-proto
|
||||
commit: 1935555c206d4afb9e94615dfd0fad31
|
||||
digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377
|
||||
- remote: buf.build
|
||||
owner: cosmos
|
||||
repository: gogo-proto
|
||||
commit: 34d970b699f84aa382f3c29773a60836
|
||||
commit: 5e5b9fdd01804356895f8f79a6f1ddc1
|
||||
digest: shake256:0b85da49e2e5f9ebc4806eae058e2f56096ff3b1c59d1fb7c190413dd15f45dd456f0b69ced9059341c80795d2b6c943de15b120a9e0308b499e43e4b5fc2952
|
||||
- remote: buf.build
|
||||
owner: googleapis
|
||||
repository: googleapis
|
||||
commit: 5ae7f88519b04fe1965da0f8a375a088
|
||||
commit: cc916c31859748a68fd229a3c8d7a2e8
|
||||
digest: shake256:469b049d0eb04203d5272062636c078decefc96fec69739159c25d85349c50c34c7706918a8b216c5c27f76939df48452148cff8c5c3ae77fa6ba5c25c1b8bf8
|
||||
|
||||
@ -8,7 +8,7 @@ import "cosmos/circuit/v1/types.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "cosmos/query/v1/query.proto";
|
||||
|
||||
// Msg defines the crisis Msg service.
|
||||
// Query defines the circuit Msg service.
|
||||
service Query {
|
||||
// Account returns account permissions.
|
||||
rpc Account(QueryAccountRequest) returns (AccountResponse) {
|
||||
|
||||
@ -6,7 +6,7 @@ option go_package = "cosmossdk.io/x/circuit/types";
|
||||
import "cosmos/msg/v1/msg.proto";
|
||||
import "cosmos/circuit/v1/types.proto";
|
||||
|
||||
// Msg defines the crisis Msg service.
|
||||
// Msg defines the circuit Msg service.
|
||||
service Msg {
|
||||
option (cosmos.msg.v1.service) = true;
|
||||
|
||||
|
||||
@ -1,14 +1,6 @@
|
||||
# this script is for generating protobuf files for the new google.golang.org/protobuf API
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
protoc_install_gopulsar() {
|
||||
go install github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest
|
||||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||
}
|
||||
|
||||
protoc_install_gopulsar
|
||||
|
||||
echo "Cleaning API directory"
|
||||
(cd api; find ./ -type f \( -iname \*.pulsar.go -o -iname \*.pb.go -o -iname \*.cosmos_orm.go -o -iname \*.pb.gw.go \) -delete; find . -empty -type d -delete; cd ..)
|
||||
|
||||
@ -16,7 +8,7 @@ echo "Generating API module"
|
||||
(cd proto; buf generate --template buf.gen.pulsar.yaml)
|
||||
|
||||
echo "Generate Pulsar Test Data"
|
||||
(cd testutil/testdata; buf generate --template buf.gen.pulsar.yaml)
|
||||
(cd testutil/testdata; buf mod update; buf generate --template buf.gen.pulsar.yaml)
|
||||
|
||||
echo "Generate x/tx"
|
||||
(cd x/tx; make codegen)
|
||||
@ -23,10 +23,10 @@ done
|
||||
cd ..
|
||||
|
||||
# generate codec/testdata proto code
|
||||
(cd testutil/testdata; buf generate)
|
||||
(cd testutil/testdata; buf mod update; buf generate)
|
||||
|
||||
# generate baseapp test messages
|
||||
(cd baseapp/testutil; buf generate)
|
||||
(cd baseapp/testutil; buf mod update; buf generate)
|
||||
|
||||
# move proto files to the right places
|
||||
cp -r github.com/cosmos/cosmos-sdk/* ./
|
||||
|
||||
14
testutil/testdata/buf.lock
vendored
14
testutil/testdata/buf.lock
vendored
@ -5,7 +5,19 @@ deps:
|
||||
owner: cosmos
|
||||
repository: cosmos-proto
|
||||
commit: 1935555c206d4afb9e94615dfd0fad31
|
||||
digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377
|
||||
- remote: buf.build
|
||||
owner: cosmos
|
||||
repository: cosmos-sdk
|
||||
commit: e0dcb5ad221c4c3b8166c04751084b9d
|
||||
digest: shake256:31ac8086ce294d2e388d266f9a867789710109b7e7ce647fad404569f5b57af407607d5ff85e609e9bc32f5abf7acdc9ec94c053865bd1f6d9f1ac0d58a99ebb
|
||||
- remote: buf.build
|
||||
owner: cosmos
|
||||
repository: gogo-proto
|
||||
commit: 6652e3443c3b4504bb3bf82e73a7e409
|
||||
commit: 5e5b9fdd01804356895f8f79a6f1ddc1
|
||||
digest: shake256:0b85da49e2e5f9ebc4806eae058e2f56096ff3b1c59d1fb7c190413dd15f45dd456f0b69ced9059341c80795d2b6c943de15b120a9e0308b499e43e4b5fc2952
|
||||
- remote: buf.build
|
||||
owner: googleapis
|
||||
repository: googleapis
|
||||
commit: 5ae7f88519b04fe1965da0f8a375a088
|
||||
digest: shake256:27d9fcdc0e3eb957449dc3d17e2d24c7ce59c3c483ecf128818183c336dfd28595ecd13771fb3172247775caf7707c4076dd8e70c5ac2cbcac170df35e4d0028
|
||||
|
||||
1
testutil/testdata/buf.yaml
vendored
1
testutil/testdata/buf.yaml
vendored
@ -1,4 +1,5 @@
|
||||
version: v1
|
||||
deps:
|
||||
- buf.build/cosmos/cosmos-sdk
|
||||
- buf.build/cosmos/gogo-proto
|
||||
- buf.build/cosmos/cosmos-proto
|
||||
|
||||
@ -36,7 +36,7 @@ func (k *Keeper) ExportGenesis(ctx sdk.Context) (data *types.GenesisState) {
|
||||
}
|
||||
}
|
||||
|
||||
// InitGenesis initializes the bank module's state from a given genesis state.
|
||||
// InitGenesis initializes the circuit module's state from a given genesis state.
|
||||
func (k *Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) {
|
||||
for _, accounts := range genState.AccountPermissions {
|
||||
add, err := k.addressCodec.StringToBytes(accounts.Address)
|
||||
|
||||
@ -19,7 +19,7 @@ type msgServer struct {
|
||||
|
||||
var _ types.MsgServer = msgServer{}
|
||||
|
||||
// NewMsgServerImpl returns an implementation of the bank MsgServer interface
|
||||
// NewMsgServerImpl returns an implementation of the circuit MsgServer interface
|
||||
// for the provided Keeper.
|
||||
func NewMsgServerImpl(keeper Keeper) types.MsgServer {
|
||||
return &msgServer{Keeper: keeper}
|
||||
|
||||
@ -17,7 +17,7 @@ type QueryServer struct {
|
||||
keeper Keeper
|
||||
}
|
||||
|
||||
// NewMsgServerImpl returns an implementation of the bank MsgServer interface
|
||||
// NewMsgServerImpl returns an implementation of the circuit MsgServer interface
|
||||
// for the provided Keeper.
|
||||
func NewQueryServer(keeper Keeper) types.QueryServer {
|
||||
return &QueryServer{keeper: keeper}
|
||||
|
||||
@ -117,16 +117,11 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule {
|
||||
}
|
||||
}
|
||||
|
||||
// Name returns the circuit module's name.
|
||||
func (AppModule) Name() string { return types.ModuleName }
|
||||
|
||||
// RegisterInvariants registers the circuit module invariants.
|
||||
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
|
||||
}
|
||||
|
||||
// ConsensusVersion implements AppModule/ConsensusVersion.
|
||||
func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion }
|
||||
|
||||
// InitGenesis performs genesis initialization for the circuit module. It returns
|
||||
// no validator updates.
|
||||
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate {
|
||||
start := time.Now()
|
||||
var genesisState types.GenesisState
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/types/msgservice"
|
||||
)
|
||||
|
||||
// RegisterLegacyAminoCodec registers the necessary x/bank interfaces and concrete types
|
||||
// RegisterLegacyAminoCodec registers the necessary circuit interfaces and concrete types
|
||||
// on the provided LegacyAmino codec. These types are used for Amino JSON serialization.
|
||||
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
||||
legacy.RegisterAminoMsg(cdc, &MsgAuthorizeCircuitBreaker{}, "cosmos-sdk/MsgAuthorizeCircuitBreaker")
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
codegen:
|
||||
@(cd internal/testpb; buf generate)
|
||||
@(cd internal/testpb; buf mod update; buf generate)
|
||||
@(cd signing/aminojson/internal; make codegen)
|
||||
@ -5,7 +5,19 @@ deps:
|
||||
owner: cosmos
|
||||
repository: cosmos-proto
|
||||
commit: 1935555c206d4afb9e94615dfd0fad31
|
||||
digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377
|
||||
- remote: buf.build
|
||||
owner: cosmos
|
||||
repository: cosmos-sdk
|
||||
commit: e0dcb5ad221c4c3b8166c04751084b9d
|
||||
digest: shake256:31ac8086ce294d2e388d266f9a867789710109b7e7ce647fad404569f5b57af407607d5ff85e609e9bc32f5abf7acdc9ec94c053865bd1f6d9f1ac0d58a99ebb
|
||||
- remote: buf.build
|
||||
owner: cosmos
|
||||
repository: gogo-proto
|
||||
commit: 6652e3443c3b4504bb3bf82e73a7e409
|
||||
commit: 5e5b9fdd01804356895f8f79a6f1ddc1
|
||||
digest: shake256:0b85da49e2e5f9ebc4806eae058e2f56096ff3b1c59d1fb7c190413dd15f45dd456f0b69ced9059341c80795d2b6c943de15b120a9e0308b499e43e4b5fc2952
|
||||
- remote: buf.build
|
||||
owner: googleapis
|
||||
repository: googleapis
|
||||
commit: 5ae7f88519b04fe1965da0f8a375a088
|
||||
digest: shake256:27d9fcdc0e3eb957449dc3d17e2d24c7ce59c3c483ecf128818183c336dfd28595ecd13771fb3172247775caf7707c4076dd8e70c5ac2cbcac170df35e4d0028
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
version: v1
|
||||
deps:
|
||||
- buf.build/cosmos/cosmos-sdk
|
||||
- buf.build/cosmos/cosmos-proto
|
||||
- buf.build/cosmos/gogo-proto
|
||||
lint:
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
codegen:
|
||||
@echo "Generating proto files"
|
||||
@buf mod update
|
||||
@buf generate
|
||||
@ -5,7 +5,19 @@ deps:
|
||||
owner: cosmos
|
||||
repository: cosmos-proto
|
||||
commit: 1935555c206d4afb9e94615dfd0fad31
|
||||
digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377
|
||||
- remote: buf.build
|
||||
owner: cosmos
|
||||
repository: cosmos-sdk
|
||||
commit: e0dcb5ad221c4c3b8166c04751084b9d
|
||||
digest: shake256:31ac8086ce294d2e388d266f9a867789710109b7e7ce647fad404569f5b57af407607d5ff85e609e9bc32f5abf7acdc9ec94c053865bd1f6d9f1ac0d58a99ebb
|
||||
- remote: buf.build
|
||||
owner: cosmos
|
||||
repository: gogo-proto
|
||||
commit: 34d970b699f84aa382f3c29773a60836
|
||||
commit: 5e5b9fdd01804356895f8f79a6f1ddc1
|
||||
digest: shake256:0b85da49e2e5f9ebc4806eae058e2f56096ff3b1c59d1fb7c190413dd15f45dd456f0b69ced9059341c80795d2b6c943de15b120a9e0308b499e43e4b5fc2952
|
||||
- remote: buf.build
|
||||
owner: googleapis
|
||||
repository: googleapis
|
||||
commit: 5ae7f88519b04fe1965da0f8a375a088
|
||||
digest: shake256:27d9fcdc0e3eb957449dc3d17e2d24c7ce59c3c483ecf128818183c336dfd28595ecd13771fb3172247775caf7707c4076dd8e70c5ac2cbcac170df35e4d0028
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
version: v1
|
||||
deps:
|
||||
- buf.build/cosmos/cosmos-sdk
|
||||
- buf.build/cosmos/gogo-proto
|
||||
- buf.build/cosmos/cosmos-proto
|
||||
lint:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user