mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-28 04:01:40 +00:00
Update Makefile (#3949)
* Update makefile - these two files were taken from the sdk with adjustments for usage in TM Signed-off-by: Marko Baricevic <marbar3778@yahoo.com> * .phony * remove slate * more tools * circleci update 1/2 * fixed typo * fixed bash error * '<<' must be escaped in 2.1 * fixed invalid config * removed golangci-lint from tools. runs as github app now * one more issue in Circle config * some more work on the Circle config * minor changes * fiddling with restore cache config * fiddling with restore cache config * added commands in circle config. makefile changes * bash shenannigans * bash shenannigans * fighting the config demons * fighting the config demons, v2 * fighting the config demons, v3 * updating p2p dockerfile * updating p2p dockerfile * updating p2p test * updating p2p test * testing circle config * testing circle config * remove dontcover command * its the weekend, custom docker image
This commit is contained in:
92
scripts/devtools/Makefile
Normal file
92
scripts/devtools/Makefile
Normal file
@ -0,0 +1,92 @@
|
||||
###
|
||||
# Find OS and Go environment
|
||||
# GO contains the Go binary
|
||||
# FS contains the OS file separator
|
||||
###
|
||||
ifeq ($(OS),Windows_NT)
|
||||
GO := $(shell where go.exe 2> NUL)
|
||||
FS := "\\"
|
||||
else
|
||||
GO := $(shell command -v go 2> /dev/null)
|
||||
FS := "/"
|
||||
endif
|
||||
|
||||
ifeq ($(GO),)
|
||||
$(error could not find go. Is it in PATH? $(GO))
|
||||
endif
|
||||
|
||||
GOPATH ?= $(shell $(GO) env GOPATH)
|
||||
GITHUBDIR := $(GOPATH)$(FS)src$(FS)github.com
|
||||
|
||||
###
|
||||
# Functions
|
||||
###
|
||||
|
||||
go_get = $(if $(findstring Windows_NT,$(OS)),\
|
||||
IF NOT EXIST $(GITHUBDIR)$(FS)$(1)$(FS) ( mkdir $(GITHUBDIR)$(FS)$(1) ) else (cd .) &\
|
||||
IF NOT EXIST $(GITHUBDIR)$(FS)$(1)$(FS)$(2)$(FS) ( cd $(GITHUBDIR)$(FS)$(1) && git clone https://github.com/$(1)/$(2) ) else (cd .) &\
|
||||
,\
|
||||
mkdir -p $(GITHUBDIR)$(FS)$(1) &&\
|
||||
(test ! -d $(GITHUBDIR)$(FS)$(1)$(FS)$(2) && cd $(GITHUBDIR)$(FS)$(1) && git clone https://github.com/$(1)/$(2)) || true &&\
|
||||
)\
|
||||
cd $(GITHUBDIR)$(FS)$(1)$(FS)$(2) && git fetch origin && git checkout -q $(3)
|
||||
|
||||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||
mkfile_dir := $(shell cd $(shell dirname $(mkfile_path)); pwd)
|
||||
|
||||
###
|
||||
# tools
|
||||
###
|
||||
|
||||
TOOLS_DESTDIR ?= $(GOPATH)/bin
|
||||
|
||||
GOIMPORTS = $(TOOLS_DESTDIR)/goimports
|
||||
CERTSTRAP = $(TOOLS_DESTDIR)/certstrap
|
||||
PROTOBUF = $(TOOLS_DESTDIR)/protoc
|
||||
GOX = $(TOOLS_DESTDIR)/gox
|
||||
GOODMAN = $(TOOLS_DESTDIR)/goodman
|
||||
|
||||
all: tools
|
||||
|
||||
tools: goimports certstrap protobuf gox goodman
|
||||
|
||||
check: check_tools
|
||||
|
||||
check_tools:
|
||||
@# https://stackoverflow.com/a/25668869
|
||||
@echo "Found tools: $(foreach tool,$(notdir $(GOTOOLS)),\
|
||||
$(if $(shell which $(tool)),$(tool),$(error "No $(tool) in PATH")))"
|
||||
|
||||
goimports: $(GOIMPORTS)
|
||||
$(GOIMPORTS):
|
||||
@echo "Get goimports@v0.0.0-20190628034336-212fb13d595e"
|
||||
@go get golang.org/x/tools/cmd/goimports@v0.0.0-20190628034336-212fb13d595e
|
||||
|
||||
certstrap: $(CERTSTRAP)
|
||||
$(CERTSTRAP):
|
||||
@echo "Get Certstrap"
|
||||
@go get github.com/square/certstrap@338204a88c4349b1c135eac1e8c14c693ad007da
|
||||
|
||||
protobuf: $(PROTOBUF)
|
||||
$(PROTOBUF):
|
||||
@echo "Get Protobuf"
|
||||
## protobuf v1.3.0
|
||||
@go get github.com/gogo/protobuf/protoc-gen-gogo@0ca988a254f991240804bf9821f3450d87ccbb1b
|
||||
|
||||
gox: $(GOX)
|
||||
$(GOX):
|
||||
@echo "Get Gox"
|
||||
# used to build tm-monitor & tm-bench binaries
|
||||
## gox v1.0.1
|
||||
@go get github.com/mitchellh/gox@d8caaff5a9dc98f4cfa1fcce6e7265a04689f641
|
||||
|
||||
goodman: $(GOODMAN)
|
||||
$(GOODMAN):
|
||||
@echo "Get Goodman"
|
||||
@go get github.com/snikch/goodman/cmd/goodman@10e37e294daa3c9a90abded60ff9924bafab3888
|
||||
|
||||
tools-clean:
|
||||
rm -f $(CERTSTRAP) $(GOIMPORTS) $(PROTOBUF) $(GOX) $(GOODMAN)
|
||||
rm -f tools-stamp
|
||||
|
||||
.PHONY: all tools tools-clean
|
@ -1,73 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# This file downloads all of the binary dependencies we have, and checks out a
|
||||
# specific git hash.
|
||||
#
|
||||
# repos it installs:
|
||||
# github.com/golang/dep/cmd/dep
|
||||
# github.com/gogo/protobuf/protoc-gen-gogo
|
||||
# github.com/square/certstrap
|
||||
# github.com/mitchellh/gox
|
||||
# github.com/golangci/golangci-lint
|
||||
# github.com/petermattis/goid
|
||||
# github.com/sasha-s/go-deadlock
|
||||
# goimports
|
||||
|
||||
## check if GOPATH is set
|
||||
if [ -z ${GOPATH+x} ]; then
|
||||
echo "please set GOPATH (https://github.com/golang/go/wiki/SettingGOPATH)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$GOPATH/src/github.com"
|
||||
cd "$GOPATH/src/github.com" || exit 1
|
||||
|
||||
installFromGithub() {
|
||||
repo=$1
|
||||
commit=$2
|
||||
# optional
|
||||
subdir=$3
|
||||
echo "--> Installing $repo ($commit)..."
|
||||
if [ ! -d "$repo" ]; then
|
||||
mkdir -p "$repo"
|
||||
git clone "https://github.com/$repo.git" "$repo"
|
||||
fi
|
||||
if [ ! -z ${subdir+x} ] && [ ! -d "$repo/$subdir" ]; then
|
||||
echo "ERROR: no such directory $repo/$subdir"
|
||||
exit 1
|
||||
fi
|
||||
pushd "$repo" && \
|
||||
git fetch origin && \
|
||||
git checkout -q "$commit" && \
|
||||
if [ ! -z ${subdir+x} ]; then cd "$subdir" || exit 1; fi && \
|
||||
go install && \
|
||||
if [ ! -z ${subdir+x} ]; then cd - || exit 1; fi && \
|
||||
popd || exit 1
|
||||
echo "--> Done"
|
||||
echo ""
|
||||
}
|
||||
|
||||
######################## DEVELOPER TOOLS #####################################
|
||||
## protobuf v1.3.0
|
||||
installFromGithub gogo/protobuf 0ca988a254f991240804bf9821f3450d87ccbb1b protoc-gen-gogo
|
||||
|
||||
installFromGithub square/certstrap 338204a88c4349b1c135eac1e8c14c693ad007da
|
||||
|
||||
# used to build tm-monitor & tm-bench binaries
|
||||
## gox v1.0.1
|
||||
installFromGithub mitchellh/gox d8caaff5a9dc98f4cfa1fcce6e7265a04689f641
|
||||
|
||||
## Trying to install golangci with Go 1.13 gives:
|
||||
## go: github.com/go-critic/go-critic@v0.0.0-20181204210945-1df300866540: invalid pseudo-version: does not match version-control timestamp (2019-05-26T07:48:19Z)
|
||||
## golangci-lint v1.17.1
|
||||
# installFromGithub golangci/golangci-lint 4ba2155996359eabd8800d1fbf3e3a9777c80490 cmd/golangci-lint
|
||||
|
||||
## Trying to install golangci with Go 1.13 gives:
|
||||
## go: cannot find main module, but found .git/config in /go/src/github.com/petermattis/goid
|
||||
## make test_with_deadlock
|
||||
## XXX: https://github.com/tendermint/tendermint/issues/3242
|
||||
# installFromGithub petermattis/goid b0b1615b78e5ee59739545bb38426383b2cda4c9
|
||||
# installFromGithub sasha-s/go-deadlock d68e2bc52ae3291765881b9056f2c1527f245f1e
|
||||
# go get golang.org/x/tools/cmd/goimports
|
||||
# installFromGithub snikch/goodman 10e37e294daa3c9a90abded60ff9924bafab3888 cmd/goodman
|
27
scripts/install-golangci-lint.sh
Normal file
27
scripts/install-golangci-lint.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
f_sha256() {
|
||||
local l_file
|
||||
l_file=$1
|
||||
python -sBc "import hashlib;print(hashlib.sha256(open('$l_file','rb').read()).hexdigest())"
|
||||
}
|
||||
|
||||
installer="$(mktemp)"
|
||||
trap "rm -f ${installer}" EXIT
|
||||
|
||||
GOBIN="${1}"
|
||||
VERSION="${2}"
|
||||
HASHSUM="${3}"
|
||||
CURL="$(which curl)"
|
||||
|
||||
echo "Downloading golangci-lint ${VERSION} installer ..." >&2
|
||||
"${CURL}" -sfL "https://raw.githubusercontent.com/golangci/golangci-lint/${VERSION}/install.sh" > "${installer}"
|
||||
|
||||
echo "Checking hashsum ..." >&2
|
||||
[ "${HASHSUM}" = "$(f_sha256 ${installer})" ]
|
||||
chmod +x "${installer}"
|
||||
|
||||
echo "Launching installer ..." >&2
|
||||
exec "${installer}" -d -b "${GOBIN}" "${VERSION}"
|
Reference in New Issue
Block a user