Skip to content

Commit

Permalink
Folder cleanu to fix build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Dusek committed Mar 11, 2024
1 parent 2e0bb01 commit 500478a
Show file tree
Hide file tree
Showing 16 changed files with 217 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
ibcante "github.com/cosmos/ibc-go/v4/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
ibcconsumerkeeper "github.com/cosmos/interchain-security/x/ccv/consumer/keeper"
consumerante "github.com/onomyprotocol/onex/app/consumer-democracy/consumer-ante"
democracyante "github.com/onomyprotocol/onex/app/consumer-democracy/consumer-democracy-ante"
consumerante "github.com/onomyprotocol/onex/app/consumer-ante"
democracyante "github.com/onomyprotocol/onex/app/consumer-democracy-ante"
)

// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
appProvider "github.com/cosmos/interchain-security/app/provider"
e2e "github.com/cosmos/interchain-security/tests/e2e"
icstestingutils "github.com/cosmos/interchain-security/testutil/ibc_testing"
appConsumerDemocracy "github.com/onomyprotocol/onex/app/consumer-democracy"
appConsumerDemocracy "github.com/onomyprotocol/onex/app"
"github.com/stretchr/testify/suite"
)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/cosmos/cosmos-sdk/simapp"
ibctesting "github.com/cosmos/interchain-security/legacy_ibc_testing/testing"
appConsumer "github.com/onomyprotocol/onex/app/consumer-democracy"
appConsumer "github.com/onomyprotocol/onex/app"
"github.com/stretchr/testify/require"
"github.com/tendermint/spm/cosmoscmd"
"github.com/tendermint/tendermint/libs/log"
Expand Down
2 changes: 1 addition & 1 deletion cmd/consumer-democracy/main.go → cmd/onexd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
app "github.com/onomyprotocol/onex/app/consumer-democracy"
app "github.com/onomyprotocol/onex/app"
"github.com/tendermint/spm/cosmoscmd"
)

Expand Down
171 changes: 155 additions & 16 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
PACKAGES=$(shell go list ./... | grep -v '/simulation')
VERSION := $(shell git describe --abbrev=6 --dirty --always --tags)
COMMIT := $(shell git log -1 --format='%H')
IMPORT_PREFIX=github.com/onomyprotocol
SCAN_FILES := $(shell find . -type f -name '*.go' -not -name '*mock.go' -not -name '*_gen.go' -not -path "*/vendor/*")

# don't override user values
ifeq (,$(VERSION))
VERSION := $(shell git describe --exact-match 2>/dev/null)
# if VERSION is empty, then populate it with branch's name and raw commit hash
ifeq (,$(VERSION))
VERSION := $(BRANCH)-$(COMMIT)
endif
endif



build_tags = netgo
ifeq ($(LEDGER_ENABLED),true)
Expand All @@ -16,7 +24,7 @@ ifeq ($(LEDGER_ENABLED),true)
else
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S),OpenBSD)
$(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988))
$(warning OpenBSD detected, disabling ledger support (https://github.com/onomyprotocol/cosmos-sdk/issues/1988))
else
GCC = $(shell command -v gcc 2> /dev/null)
ifeq ($(GCC),)
Expand All @@ -28,7 +36,7 @@ ifeq ($(LEDGER_ENABLED),true)
endif
endif

ifeq (cleveldb,$(findstring cleveldb,$(ONOMY_BUILD_OPTIONS)))
ifeq (cleveldb,$(findstring cleveldb,$(GAIA_BUILD_OPTIONS)))
build_tags += gcc
endif
build_tags += $(BUILD_TAGS)
Expand All @@ -39,19 +47,150 @@ whitespace += $(whitespace)
comma := ,
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))

ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=onex \
-X github.com/cosmos/cosmos-sdk/version.AppName=onex \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT)
ldflags += $(LDFLAGS)
ldflags := $(strip $(ldflags))
ldflags = -X github.com/onomyprotocol/cosmos-sdk/version.Name=onex \
-X github.com/onomyprotocol/cosmos-sdk/version.AppName=onexd \
-X github.com/onomyprotocol/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/onomyprotocol/cosmos-sdk/version.Commit=$(COMMIT) \
-X "github.com/onomyprotocol/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \


BUILD_FLAGS := -ldflags '$(ldflags)' -gcflags="all=-N -l"

all:
all: install

install: go.sum
@echo ls
go install $(BUILD_FLAGS) ./cmd/consumer-democracy

go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
GO111MODULE=on go mod verify

test:
go test -mod=readonly ./...
@go test -mod=readonly $(PACKAGES)

# look into .golangci.yml for enabling / disabling linters
lint:
@echo "--> Running linter"
@golangci-lint run
@go mod verify

###############################################################################
### Protobuf ###
###############################################################################

proto-gen:
./contrib/local/protocgen.sh

proto-lint:
buf check lint --error-format=json

proto-check-breaking:
buf check breaking --against-input '.git#branch=master'

TM_URL = https://raw.githubusercontent.com/tendermint/tendermint/v0.34.0-rc3/proto/tendermint
GOGO_PROTO_URL = https://raw.githubusercontent.com/regen-network/protobuf/cosmos
COSMOS_PROTO_URL = https://raw.githubusercontent.com/regen-network/cosmos-proto/master
COSMOS_SDK_PROTO_URL = https://raw.githubusercontent.com/onomyprotocol/cosmos-sdk/master/proto/cosmos/base

TM_CRYPTO_TYPES = third_party/proto/tendermint/crypto
TM_ABCI_TYPES = third_party/proto/tendermint/abci
TM_TYPES = third_party/proto/tendermint/types
TM_VERSION = third_party/proto/tendermint/version
TM_LIBS = third_party/proto/tendermint/libs/bits

GOGO_PROTO_TYPES = third_party/proto/gogoproto
COSMOS_PROTO_TYPES = third_party/proto/cosmos_proto

SDK_ABCI_TYPES = third_party/proto/cosmos/base/abci/v1beta1
SDK_QUERY_TYPES = third_party/proto/cosmos/base/query/v1beta1
SDK_COIN_TYPES = third_party/proto/cosmos/base/v1beta1

proto-update-deps:
# TODO: also download
# - google/api/annotations.proto
# - google/api/http.proto
# - google/api/httpbody.proto
# - google/protobuf/any.proto
mkdir -p $(GOGO_PROTO_TYPES)
curl -sSL $(GOGO_PROTO_URL)/gogoproto/gogo.proto > $(GOGO_PROTO_TYPES)/gogo.proto

mkdir -p $(COSMOS_PROTO_TYPES)
curl -sSL $(COSMOS_PROTO_URL)/cosmos.proto > $(COSMOS_PROTO_TYPES)/cosmos.proto

mkdir -p $(TM_ABCI_TYPES)
curl -sSL $(TM_URL)/abci/types.proto > $(TM_ABCI_TYPES)/types.proto

mkdir -p $(TM_VERSION)
curl -sSL $(TM_URL)/version/types.proto > $(TM_VERSION)/types.proto

mkdir -p $(TM_TYPES)
curl -sSL $(TM_URL)/types/types.proto > $(TM_TYPES)/types.proto
curl -sSL $(TM_URL)/types/evidence.proto > $(TM_TYPES)/evidence.proto
curl -sSL $(TM_URL)/types/params.proto > $(TM_TYPES)/params.proto

mkdir -p $(TM_CRYPTO_TYPES)
curl -sSL $(TM_URL)/crypto/proof.proto > $(TM_CRYPTO_TYPES)/proof.proto
curl -sSL $(TM_URL)/crypto/keys.proto > $(TM_CRYPTO_TYPES)/keys.proto

mkdir -p $(TM_LIBS)
curl -sSL $(TM_URL)/libs/bits/types.proto > $(TM_LIBS)/types.proto

mkdir -p $(SDK_ABCI_TYPES)
curl -sSL $(COSMOS_SDK_PROTO_URL)/abci/v1beta1/abci.proto > $(SDK_ABCI_TYPES)/abci.proto

mkdir -p $(SDK_QUERY_TYPES)
curl -sSL $(COSMOS_SDK_PROTO_URL)/query/v1beta1/pagination.proto > $(SDK_QUERY_TYPES)/pagination.proto

mkdir -p $(SDK_COIN_TYPES)
curl -sSL $(COSMOS_SDK_PROTO_URL)/v1beta1/coin.proto > $(SDK_COIN_TYPES)/coin.proto

PREFIX ?= /usr/local
BIN ?= $(PREFIX)/bin
UNAME_S ?= $(shell uname -s)
UNAME_M ?= $(shell uname -m)

BUF_VERSION ?= 0.11.0

PROTOC_VERSION ?= 3.11.2
ifeq ($(UNAME_S),Linux)
PROTOC_ZIP ?= protoc-${PROTOC_VERSION}-linux-x86_64.zip
endif
ifeq ($(UNAME_S),Darwin)
PROTOC_ZIP ?= protoc-${PROTOC_VERSION}-osx-x86_64.zip
endif

proto-tools: proto-tools-stamp buf

proto-tools-stamp:
echo "Installing protoc compiler..."
(cd /tmp; \
curl -OL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}"; \
unzip -o ${PROTOC_ZIP} -d $(PREFIX) bin/protoc; \
unzip -o ${PROTOC_ZIP} -d $(PREFIX) 'include/*'; \
rm -f ${PROTOC_ZIP})

echo "Installing protoc-gen-gocosmos..."
go install github.com/regen-network/cosmos-proto/protoc-gen-gocosmos

# Create dummy file to satisfy dependency and avoid
# rebuilding when this Makefile target is hit twice
# in a row
touch $@

buf: buf-stamp

buf-stamp:
echo "Installing buf..."
curl -sSL \
"https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-${UNAME_S}-${UNAME_M}" \
-o "${BIN}/buf" && \
chmod +x "${BIN}/buf"

touch $@

build:
go build $(BUILD_FLAGS) ./cmd/onexd

build:
go build $(BUILD_FLAGS) ./cmd/consumer-democracy
mv ./consumer-democracy onexd
tools-clean:
rm -f proto-tools-stamp buf-stamp
57 changes: 57 additions & 0 deletions makefile_backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
PACKAGES=$(shell go list ./... | grep -v '/simulation')
VERSION := $(shell git describe --abbrev=6 --dirty --always --tags)
COMMIT := $(shell git log -1 --format='%H')
IMPORT_PREFIX=github.com/onomyprotocol
SCAN_FILES := $(shell find . -type f -name '*.go' -not -name '*mock.go' -not -name '*_gen.go' -not -path "*/vendor/*")

build_tags = netgo
ifeq ($(LEDGER_ENABLED),true)
ifeq ($(OS),Windows_NT)
GCCEXE = $(shell where gcc.exe 2> NUL)
ifeq ($(GCCEXE),)
$(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
endif
else
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S),OpenBSD)
$(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988))
else
GCC = $(shell command -v gcc 2> /dev/null)
ifeq ($(GCC),)
$(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
endif
endif
endif
endif

ifeq (cleveldb,$(findstring cleveldb,$(ONOMY_BUILD_OPTIONS)))
build_tags += gcc
endif
build_tags += $(BUILD_TAGS)
build_tags := $(strip $(build_tags))

whitespace :=
whitespace += $(whitespace)
comma := ,
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))

ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=onex \
-X github.com/cosmos/cosmos-sdk/version.AppName=onex \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT)
ldflags += $(LDFLAGS)
ldflags := $(strip $(ldflags))
BUILD_FLAGS := -ldflags '$(ldflags)' -gcflags="all=-N -l"

all:

test:
go test -mod=readonly ./...

build:
go build $(BUILD_FLAGS) ./cmd/consumer-democracy
mv ./consumer-democracy onexd

0 comments on commit 500478a

Please sign in to comment.