From 3c4aa85c69f7af2a18de6d2cb92f9e7add3861b9 Mon Sep 17 00:00:00 2001 From: "Anand Babu (AB) Periasamy" Date: Wed, 25 Mar 2015 22:51:19 -0700 Subject: [PATCH] git commit hash generator --- .gitignore | 1 + Makefile | 20 ++++++++++++-------- buildscripts/git-commit-id.sh | 19 +++++++++++++++++++ main.go | 8 ++------ 4 files changed, 34 insertions(+), 14 deletions(-) create mode 100644 buildscripts/git-commit-id.sh diff --git a/.gitignore b/.gitignore index 17e37e08d..c976dd4d8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +/build-constants.go **/*.swp cover.out *~ diff --git a/Makefile b/Makefile index 88a52f4cd..d8220b026 100644 --- a/Makefile +++ b/Makefile @@ -19,22 +19,26 @@ getdeps: checkdeps checkgopath 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: verifiers - @echo "Building Libraries" + @echo "Building Libraries:" @godep go generate ./... @godep go build ./... @@ -44,10 +48,10 @@ test-all: build-all test: test-all -minio: build-all test-all +minio: pre-build build-all test-all install: minio - @godep go install github.com/minio-io/minio && echo "Installed minio" + @godep go install github.com/minio-io/minio && echo "Installed minio:" save: restore @godep save ./... @@ -62,7 +66,7 @@ docs-deploy: @mkdocs gh-deploy --clean clean: - @echo "Cleaning up all the generated files" + @echo "Cleaning up all the generated files:" @rm -fv pkg/utils/split/TESTPREFIX.* @rm -fv cover.out @rm -fv pkg/storage/erasure/*.syso diff --git a/buildscripts/git-commit-id.sh b/buildscripts/git-commit-id.sh new file mode 100644 index 000000000..37daea45c --- /dev/null +++ b/buildscripts/git-commit-id.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +CONST_FILE=build-constants.go + +cat > $CONST_FILE <