diff --git a/.gitignore b/.gitignore index 22014e67..a38cf3b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +/build-constants.go cover.out mc site/ \ No newline at end of file diff --git a/Makefile b/Makefile index 18d8d89f..f8721966 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ MINIOPATH=$(GOPATH)/src/github.com/minio-io/mc all: getdeps install checkdeps: - @echo "Checking deps.." + @echo "Checking deps:" @(env bash $(PWD)/buildscripts/checkdeps.sh) checkgopath: @@ -11,34 +11,39 @@ checkgopath: @if [ ! -d ${MINIOPATH} ]; then echo "Project not found in $GOPATH, please follow instructions provided at https://github.com/Minio-io/minio/blob/master/CONTRIBUTING.md#setup-your-minio-github-repository" && exit 1; fi getdeps: checkdeps checkgopath - @go get github.com/tools/godep && echo "Installed godep" - @go get github.com/golang/lint/golint && echo "Installed golint" - @go get golang.org/x/tools/cmd/vet && echo "Installed vet" - @go get github.com/fzipp/gocyclo && echo "Installed gocyclo" + @go get github.com/tools/godep && echo "Installed godep:" + @go get github.com/golang/lint/golint && echo "Installed golint:" + @go get golang.org/x/tools/cmd/vet && echo "Installed vet:" + @go get github.com/fzipp/gocyclo && echo "Installed gocyclo:" verifiers: getdeps vet fmt lint cyclo vet: - @echo "Running $@" + @echo "Running $@:" @go vet ./... fmt: - @echo "Running $@" + @echo "Running $@:" @test -z "$$(gofmt -s -l . | grep -v Godeps/_workspace/src/ | tee /dev/stderr)" || \ echo "+ please format Go code with 'gofmt -s'" lint: - @echo "Running $@" + @echo "Running $@:" @test -z "$$(golint ./... | grep -v Godeps/_workspace/src/ | tee /dev/stderr)" cyclo: - @echo "Running $@" + @echo "Running $@:" @test -z "$$(gocyclo -over 15 . | grep -v Godeps/_workspace/src/ | tee /dev/stderr)" +pre-build: + @echo "Running pre-build:" + @(env bash $(PWD)/buildscripts/git-commit-id.sh) + + build-all: getdeps verifiers - @echo "Building Libraries" + @echo "Building Libraries:" @godep go generate ./... @godep go build ./... -test-all: build-all +test-all: pre-build build-all @echo "Running Test Suites:" @godep go test -race ./... @@ -55,5 +60,10 @@ docs-deploy: @mkdocs gh-deploy --clean install: test-all - @godep go install github.com/minio-io/mc && echo "Installed mc" + @godep go install github.com/minio-io/mc && echo "Installed mc:" @mkdir -p $(HOME)/.minio/mc + +clean: + @rm -fv cover.out + @rm -fv pkg/encoding/erasure/*.syso + @rm -fv build-constants.go diff --git a/buildscripts/git-commit-id.sh b/buildscripts/git-commit-id.sh new file mode 100644 index 00000000..37daea45 --- /dev/null +++ b/buildscripts/git-commit-id.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +CONST_FILE=build-constants.go + +cat > $CONST_FILE <