Skip to content
This repository was archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #447: Initial Application Skeleton Structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandr Bezobchuk committed Jul 19, 2018
1 parent 07e7568 commit e5e3d48
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 16 deletions.
26 changes: 24 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
[[constraint]]
name = "github.com/hashicorp/golang-lru"

[[constraint]]
name = "github.com/spf13/cobra"
version = "~0.0.1"

[[override]]
name = "google.golang.org/genproto"
revision = "7fd901a49ba6a7f87732eb344f6e3c5b19d1b200"
Expand Down
57 changes: 43 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
# Copyright 2018 Tendermint. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

PACKAGES=$(shell go list ./... | grep -v '/vendor/')
COMMIT_HASH := $(shell git rev-parse --short HEAD)
BUILD_FLAGS = -tags netgo -ldflags "-X github.com/cosmos/ethermint/version.GitCommit=${COMMIT_HASH}"
DOCKER_TAG = unstable
DOCKER_IMAGE = tendermint/ethermint
ETHERMINT_DAEMON_BINARY = emintd
ETHERMINT_CLI_BINARY = emintcli

DEP = github.com/golang/dep/cmd/dep
GOLINT = github.com/tendermint/lint/golint
Expand All @@ -26,17 +42,22 @@ GOCYCLO_CHECK := $(shell command -v gocyclo 2> /dev/null)

all: tools deps install

ci: tools deps install
#######################
### Build / Install ###
#######################

build:
ifeq ($(OS),Windows_NT)
go build $(BUILD_FLAGS) -o build/ethermint.exe ./*.go
go build $(BUILD_FLAGS) -o build/$(ETHERMINT_DAEMON_BINARY).exe ./cmd/ethermintd
go build $(BUILD_FLAGS) -o build/$(ETHERMINT_CLI_BINARY).exe ./cmd/ethermintcli
else
go build $(BUILD_FLAGS) -o build/ethermint ./*.go
go build $(BUILD_FLAGS) -o build/$(ETHERMINT_DAEMON_BINARY) ./cmd/ethermintd/
go build $(BUILD_FLAGS) -o build/$(ETHERMINT_CLI_BINARY) ./cmd/ethermintcli/
endif

install:
go install $(BUILD_FLAGS) ./*.go
go install $(BUILD_FLAGS) ./cmd/ethermintd
go install $(BUILD_FLAGS) ./cmd/ethermintcli

clean:
rm -rf ./build ./vendor
Expand All @@ -45,57 +66,61 @@ update-tools:
@echo "Updating golang dependencies"
go get -u -v $(DEP) $(GOLINT) $(GOMETALINTER) $(UNCONVERT) $(INEFFASSIGN) $(MISSPELL) $(ERRCHECK) $(UNPARAM) $(GOCYCLO)

############################
### Tools / Dependencies ###
############################

tools:
ifdef DEP_CHECK
@echo "Dep is already installed. Run 'make update-tools' to update."
@echo "Dep is already installed. Run 'make update-tools' to update."
else
@echo "Installing dep"
go get -v $(DEP)
endif
ifdef GOLINT_CHECK
@echo "Golint is already installed. Run 'make update-tools' to update."
@echo "Golint is already installed. Run 'make update-tools' to update."
else
@echo "Installing golint"
go get -v $(GOLINT)
endif
ifdef GOMETALINTER_CHECK
@echo "Gometalinter.v2 is already installed. Run 'make update-tools' to update."
@echo "Gometalinter.v2 is already installed. Run 'make update-tools' to update."
else
@echo "Installing gometalinter.v2"
go get -v $(GOMETALINTER)
endif
ifdef UNCONVERT_CHECK
@echo "Unconvert is already installed. Run 'make update-tools' to update."
@echo "Unconvert is already installed. Run 'make update-tools' to update."
else
@echo "Installing unconvert"
go get -v $(UNCONVERT)
endif
ifdef INEFFASSIGN_CHECK
@echo "Ineffassign is already installed. Run 'make update-tools' to update."
@echo "Ineffassign is already installed. Run 'make update-tools' to update."
else
@echo "Installing ineffassign"
go get -v $(INEFFASSIGN)
endif
ifdef MISSPELL_CHECK
@echo "misspell is already installed. Run 'make update-tools' to update."
@echo "misspell is already installed. Run 'make update-tools' to update."
else
@echo "Installing misspell"
go get -v $(MISSPELL)
endif
ifdef ERRCHECK_CHECK
@echo "errcheck is already installed. Run 'make update-tools' to update."
@echo "errcheck is already installed. Run 'make update-tools' to update."
else
@echo "Installing errcheck"
go get -v $(ERRCHECK)
endif
ifdef UNPARAM_CHECK
@echo "unparam is already installed. Run 'make update-tools' to update."
@echo "unparam is already installed. Run 'make update-tools' to update."
else
@echo "Installing unparam"
go get -v $(UNPARAM)
endif
ifdef GOCYCLO_CHECK
@echo "goyclo is already installed. Run 'make update-tools' to update."
@echo "goyclo is already installed. Run 'make update-tools' to update."
else
@echo "Installing goyclo"
go get -v $(GOCYCLO)
Expand All @@ -106,6 +131,10 @@ deps:
@echo "--> Running dep ensure"
@dep ensure -v

#######################
### Testing / Misc. ###
#######################

godocs:
@echo "--> Wait a few seconds and visit http://localhost:6060/pkg/github.com/cosmos/ethermint"
godoc -http=:6060
Expand All @@ -115,4 +144,4 @@ docker:
docker tag ${DOCKER_IMAGE}:${DOCKER_TAG} ${DOCKER_IMAGE}:latest
docker tag ${DOCKER_IMAGE}:${DOCKER_TAG} ${DOCKER_IMAGE}:${COMMIT_HASH}

.PHONY: build install update-tools tools deps godocs
.PHONY: build install update-tools tools deps godocs clean
45 changes: 45 additions & 0 deletions app/ethermint.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package app

import (
bam "github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/wire"
)

const (
appName = "Ethermint"
)

// EthermintApp implements an extended ABCI application.
type EthermintApp struct {
*bam.BaseApp

codec *wire.Codec
sealed bool

// TODO: stores and keys

// TODO: keepers

// TODO: mappers
}

// NewEthermintApp returns a reference to a new initialized Ethermint
// application.
func NewEthermintApp(opts ...func(*EthermintApp)) *EthermintApp {
app := &EthermintApp{}

// TODO: implement constructor

for _, opt := range opts {
opt(app)
}

app.seal()
return app
}

// seal seals the Ethermint application and prohibits any future modifications
// that change critical components.
func (app *EthermintApp) seal() {
app.sealed = true
}
7 changes: 7 additions & 0 deletions cmd/ethermintcli/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

func main() {
// TODO: Implement CLI commands and logic
//
// Ref: https://github.com/cosmos/ethermint/issues/432
}
7 changes: 7 additions & 0 deletions cmd/ethermintd/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

func main() {
// TODO: Implement daemon command and logic
//
// Ref: https://github.com/cosmos/ethermint/issues/433
}
1 change: 1 addition & 0 deletions server/start.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package server
8 changes: 8 additions & 0 deletions types/context.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package types

// AppContext provides the ability for the application to pass around and
// obtain immutable objects easily. More importantly, it allows for the
// utilization of the object-capability model in which components gain access
// to other components for which they truly need.
type AppContext struct {
}
10 changes: 10 additions & 0 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package version

// Version contains the application semantic version.
//
// TODO: How do we want to version this being that an initial Ethermint has
// been developed?
const Version = "0.0.0"

// GitCommit contains the git SHA1 short hash set by build flags.
var GitCommit = ""
Empty file added x/.keep
Empty file.

0 comments on commit e5e3d48

Please sign in to comment.