Skip to content

Commit

Permalink
Make Makefile usable (osmosis-labs#6704)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattverse authored Oct 17, 2023
1 parent 60958dd commit 85e026e
Showing 1 changed file with 35 additions and 28 deletions.
63 changes: 35 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -287,16 +287,43 @@ tidy-workspace:
### Proto ###
###############################################################################

proto-help:
@echo "proto subcommands"
@echo ""
@echo "Usage:"
@echo " make proto-[command]"
@echo ""
@echo "Available Commands:"
@echo " all Run proto-format and proto-gen"
@echo " gen Generate Protobuf files"
@echo " format Format Protobuf files"
@echo " image-build Build the protobuf Docker image"
@echo " image-push Push the protobuf Docker image"

proto: proto-help
proto-all: proto-format proto-gen

proto:
@echo
@echo "=========== Generate Message ============"
@echo
./scripts/protocgen.sh
@echo
@echo "=========== Generate Complete ============"
@echo
protoVer=v0.9
protoImageName=osmolabs/osmo-proto-gen:$(protoVer)
containerProtoGen=cosmos-sdk-proto-gen-$(protoVer)
containerProtoFmt=cosmos-sdk-proto-fmt-$(protoVer)

proto-gen:
@echo "Generating Protobuf files"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then docker start -a $(containerProtoGen); else docker run --name $(containerProtoGen) -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) \
sh ./scripts/protocgen.sh; fi

proto-format:
@echo "Formatting Protobuf files"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoFmt}$$"; then docker start -a $(containerProtoFmt); else docker run --name $(containerProtoFmt) -v $(CURDIR):/workspace --workdir /workspace tendermintdev/docker-build-proto \
find ./ -not -path "./third_party/*" -name "*.proto" -exec clang-format -i {} \; ; fi

proto-image-build:
@DOCKER_BUILDKIT=1 docker build -t $(protoImageName) -f ./proto/Dockerfile ./proto

proto-image-push:
docker push $(protoImageName)


test:
@go test -v ./x/...
Expand All @@ -319,26 +346,6 @@ docs:
@echo
.PHONY: docs

protoVer=v0.9
protoImageName=osmolabs/osmo-proto-gen:$(protoVer)
containerProtoGen=cosmos-sdk-proto-gen-$(protoVer)
containerProtoFmt=cosmos-sdk-proto-fmt-$(protoVer)

proto-gen:
@echo "Generating Protobuf files"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then docker start -a $(containerProtoGen); else docker run --name $(containerProtoGen) -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) \
sh ./scripts/protocgen.sh; fi

proto-format:
@echo "Formatting Protobuf files"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoFmt}$$"; then docker start -a $(containerProtoFmt); else docker run --name $(containerProtoFmt) -v $(CURDIR):/workspace --workdir /workspace tendermintdev/docker-build-proto \
find ./ -not -path "./third_party/*" -name "*.proto" -exec clang-format -i {} \; ; fi

proto-image-build:
@DOCKER_BUILDKIT=1 docker build -t $(protoImageName) -f ./proto/Dockerfile ./proto

proto-image-push:
docker push $(protoImageName)

###############################################################################
### Querygen ###
Expand Down

0 comments on commit 85e026e

Please sign in to comment.