summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile57
1 files changed, 34 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 6934e8545..584b84cd2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,7 @@
-.PHONY: build package run stop run-client run-server stop-client stop-server restart-server restart-client start-docker clean-dist clean nuke check-style check-unit-tests test dist setup-mac prepare-enteprise run-client-tests setup-run-client-tests cleanup-run-client-tests test-client build-linux build-osx build-windows
+.PHONY: build package run stop run-client run-server stop-client stop-server restart-server restart-client start-docker clean-dist clean nuke check-style check-client-style check-server-style check-unit-tests test dist setup-mac prepare-enteprise run-client-tests setup-run-client-tests cleanup-run-client-tests test-client build-linux build-osx build-windows internal-test-client
+
+# For golang 1.5.x compatibility (remove when we don't want to support it anymore)
+export GO15VENDOREXPERIMENT=1
# Build Flags
BUILD_NUMBER ?= $(BUILD_NUMBER:)
@@ -27,9 +30,9 @@ endif
BUILD_WEBAPP_DIR = ./webapp
# Golang Flags
-GOPATH ?= $(GOPATH:)
+GOPATH ?= $(GOPATH:):./vendor
GOFLAGS ?= $(GOFLAGS:)
-GO=$(GOPATH)/bin/godep go
+GO=go
GO_LINKER_FLAGS ?= -ldflags \
"-X github.com/mattermost/platform/model.BuildNumber=$(BUILD_NUMBER)\
-X 'github.com/mattermost/platform/model.BuildDate=$(BUILD_DATE)'\
@@ -129,7 +132,12 @@ clean-docker:
docker rm -v mattermost-openldap > /dev/null; \
fi
-check-style:
+check-client-style:
+ @echo Checking client style
+
+ cd $(BUILD_WEBAPP_DIR) && $(MAKE) check-style
+
+check-server-style:
@echo Running GOFMT
$(eval GOFMT_OUTPUT := $(shell gofmt -d -s api/ model/ store/ utils/ manualtesting/ einterfaces/ mattermost.go 2>&1))
@echo "$(GOFMT_OUTPUT)"
@@ -140,8 +148,10 @@ check-style:
exit 1; \
fi
-test: start-docker
- @echo Running tests
+check-style: check-client-style check-server-style
+
+test-server: start-docker prepare-enterprise
+ @echo Running server tests
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=340s ./api || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=12s ./model || exit 1
@@ -150,27 +160,25 @@ test: start-docker
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./web || exit 1
ifeq ($(BUILD_ENTERPRISE_READY),true)
@echo Running Enterprise tests
- $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s $(BUILD_ENTERPRISE_DIR)/ldap || exit 1
- $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s $(BUILD_ENTERPRISE_DIR)/compliance || exit 1
+ $(GO) test $(GOFLAGS) -run=$(TESTS) -c ./enterprise/ldap && ./ldap.test -test.v -test.timeout=120s || exit 1
+ $(GO) test $(GOFLAGS) -run=$(TESTS) -c ./enterprise/compliance && ./compliance.test -test.v -test.timeout=120s || exit 1
+ rm -r ldap.test
+ rm -r compliance.test
endif
-setup-run-client-tests:
- sed -i'.bak' 's|"EnableOpenServer": false,|"EnableOpenServer": true,|g' config/config.json
+internal-test-client: start-docker prepare-enterprise
+ $(GO) run $(GOFLAGS) *.go -run_client_tests
-cleanup-run-client-tests:
- sed -i'.bak' 's|"EnableOpenServer": true,|"EnableOpenServer": false,|g' config/config.json
+test-client: start-docker prepare-enterprise
+ @echo Running client tests
-run-client-tests:
cd $(BUILD_WEBAPP_DIR) && $(MAKE) test
- sleep 10
- @echo Running client side unit tests
- cd $(BUILD_WEBAPP_DIR) && npm test
-test-client: setup-run-client-tests run-server run-client-tests stop-server cleanup-run-client-tests
+test: test-server test-client
.prebuild:
@echo Preparation for running go code
- go get $(GOFLAGS) github.com/tools/godep
+ go get $(GOFLAGS) github.com/Masterminds/glide
touch $@
@@ -178,19 +186,21 @@ prepare-enterprise:
ifeq ($(BUILD_ENTERPRISE_READY),true)
@echo Enterprise build selected, preparing
cp $(BUILD_ENTERPRISE_DIR)/imports.go .
+ rm -f enterprise
+ ln -s $(BUILD_ENTERPRISE_DIR) enterprise
endif
build-linux: .prebuild prepare-enterprise
@echo Build Linux amd64
- env GOOS=linux GOARCH=amd64 $(GO) install $(GOFLAGS) $(GO_LINKER_FLAGS) ./...
+ env GOOS=linux GOARCH=amd64 $(GO) install $(GOFLAGS) $(GO_LINKER_FLAGS) $(go list ./... | grep -v /vendor/)
build-osx: .prebuild prepare-enterprise
@echo Build OSX amd64
- env GOOS=darwin GOARCH=amd64 $(GO) install $(GOFLAGS) $(GO_LINKER_FLAGS) ./...
+ env GOOS=darwin GOARCH=amd64 $(GO) install $(GOFLAGS) $(GO_LINKER_FLAGS) $(go list ./... | grep -v /vendor/)
build-windows: .prebuild prepare-enterprise
@echo Build Windows amd64
- env GOOS=windows GOARCH=amd64 $(GO) install $(GOFLAGS) $(GO_LINKER_FLAGS) ./...
+ env GOOS=windows GOARCH=amd64 $(GO) install $(GOFLAGS) $(GO_LINKER_FLAGS) $(go list ./... | grep -v /vendor/)
build: build-linux build-windows build-osx
@@ -315,10 +325,11 @@ clean: stop-docker
rm -rf api/data
rm -rf logs
- rm -rf Godeps/_workspace/pkg/
-
rm -f mattermost.log
+ rm -f npm-debug.log
+ rm -f api/mattermost.log
rm -f .prepare-go
+ rm -f enterprise
nuke: clean clean-docker
@echo BOOM