Change Makefile to use local copies of dependencies by running go through godep

Этот коммит содержится в:
hmhealey
2015-07-20 15:13:12 -04:00
родитель a09f35bdcf
Коммит 49c50f9575

Просмотреть файл

@@ -4,6 +4,13 @@ GOPATH ?= $(GOPATH:)
GOFLAGS ?= $(GOFLAGS:) GOFLAGS ?= $(GOFLAGS:)
BUILD_NUMBER ?= $(BUILD_NUMBER:) BUILD_NUMBER ?= $(BUILD_NUMBER:)
ifeq ($(shell which godep), "")
GODEP=$(GOPATH)/bin/godep
else
GODEP=godep
endif
GO=$(GODEP) go
ifeq ($(BUILD_NUMBER),) ifeq ($(BUILD_NUMBER),)
BUILD_NUMBER := dev BUILD_NUMBER := dev
endif endif
@@ -21,29 +28,27 @@ travis:
@echo building for travis @echo building for travis
rm -Rf $(DIST_ROOT) rm -Rf $(DIST_ROOT)
@go clean $(GOFLAGS) -i ./... @$(GO) clean $(GOFLAGS) -i ./...
@cd web/react/ && npm install @cd web/react/ && npm install
@go build $(GOFLAGS) ./... @$(GO) build $(GOFLAGS) ./...
@mkdir -p logs @mkdir -p logs
@go test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=180s ./api || exit 1 @$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=180s ./api || exit 1
@go test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=12s ./model || exit 1 @$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=12s ./model || exit 1
@go test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./store || exit 1 @$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./store || exit 1
@go test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./utils || exit 1 @$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./utils || exit 1
@go test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./web || exit 1 @$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./web || exit 1
build: build:
@go build $(GOFLAGS) ./... @$(GO) build $(GOFLAGS) ./...
install: install:
@go get $(GOFLAGS) github.com/tools/godep @go get $(GOFLAGS) github.com/tools/godep
@if [ $(shell docker ps -a | grep -ci mattermost-mysql) -eq 0 ]; then \ @if [ $(shell docker ps | grep -ci mattermost-mysql) -eq 0 ]; then \
echo restoring go libs using godep; \
$(GOPATH)/bin/godep restore; \
echo starting mattermost-mysql; \ echo starting mattermost-mysql; \
docker run --name mattermost-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=mostest \ docker run --name mattermost-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=mostest \
-e MYSQL_USER=mmuser -e MYSQL_PASSWORD=mostest -e MYSQL_DATABASE=mattermost_test -d mysql > /dev/null; \ -e MYSQL_USER=mmuser -e MYSQL_PASSWORD=mostest -e MYSQL_DATABASE=mattermost_test -d mysql > /dev/null; \
@@ -64,15 +69,15 @@ install:
test: install test: install
@mkdir -p logs @mkdir -p logs
@go test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=180s ./api || exit 1 @$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=180s ./api || exit 1
@go test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=12s ./model || exit 1 @$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=12s ./model || exit 1
@go test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./store || exit 1 @$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./store || exit 1
@go test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./utils || exit 1 @$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./utils || exit 1
@go test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./web || exit 1 @$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./web || exit 1
benchmark: install benchmark: install
@mkdir -p logs @mkdir -p logs
@go test $(GOFLAGS) -test.v -run=NO_TESTS -bench=$(BENCH) ./api || exit 1 @$(GO) test $(GOFLAGS) -test.v -run=NO_TESTS -bench=$(BENCH) ./api || exit 1
cover: install cover: install
rm -Rf $(DIST_RESULTS) rm -Rf $(DIST_RESULTS)
@@ -94,7 +99,7 @@ cover: install
clean: clean:
rm -Rf $(DIST_ROOT) rm -Rf $(DIST_ROOT)
@go clean $(GOFLAGS) -i ./... @$(GO) clean $(GOFLAGS) -i ./...
@if [ $(shell docker ps -a | grep -ci mattermost-mysql) -eq 1 ]; then \ @if [ $(shell docker ps -a | grep -ci mattermost-mysql) -eq 1 ]; then \
echo stopping mattermost-mysql; \ echo stopping mattermost-mysql; \
@@ -124,7 +129,7 @@ run: install
@cd web/react && npm start & @cd web/react && npm start &
@echo starting go web server @echo starting go web server
@go run $(GOFLAGS) mattermost.go -config=config.json & @$(GO) run $(GOFLAGS) mattermost.go -config=config.json &
@echo starting compass watch @echo starting compass watch
@cd web/sass-files && compass watch & @cd web/sass-files && compass watch &
@@ -161,8 +166,8 @@ cleandb:
dist: install dist: install
@go build $(GOFLAGS) -i -a ./... @$(GO) build $(GOFLAGS) -i -a ./...
@go install $(GOFLAGS) -a ./... @$(GO) install $(GOFLAGS) -a ./...
mkdir -p $(DIST_PATH)/bin mkdir -p $(DIST_PATH)/bin
cp $(GOPATH)/bin/platform $(DIST_PATH)/bin cp $(GOPATH)/bin/platform $(DIST_PATH)/bin