github.com/recobe182/terraform@v0.8.5-0.20170117231232-49ab22a935b7/Makefile (about) 1 TEST?=$$(go list ./... | grep -v '/terraform/vendor/' | grep -v '/builtin/bins/') 2 GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor) 3 4 default: test vet 5 6 tools: 7 go get -u github.com/kardianos/govendor 8 go get -u golang.org/x/tools/cmd/stringer 9 go get -u golang.org/x/tools/cmd/cover 10 11 # bin generates the releaseable binaries for Terraform 12 bin: fmtcheck generate 13 @TF_RELEASE=1 sh -c "'$(CURDIR)/scripts/build.sh'" 14 15 # dev creates binaries for testing Terraform locally. These are put 16 # into ./bin/ as well as $GOPATH/bin 17 dev: fmtcheck generate 18 @TF_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'" 19 20 quickdev: generate 21 @TF_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'" 22 23 # Shorthand for quickly building the core of Terraform. Note that some 24 # changes will require a rebuild of everything, in which case the dev 25 # target should be used. 26 core-dev: generate 27 go install -tags 'core' github.com/hashicorp/terraform 28 29 # Shorthand for quickly testing the core of Terraform (i.e. "not providers") 30 core-test: generate 31 @echo "Testing core packages..." && \ 32 go test -tags 'core' $(TESTARGS) $(shell go list ./... | grep -v -E 'terraform/(builtin|vendor)') 33 34 # Shorthand for building and installing just one plugin for local testing. 35 # Run as (for example): make plugin-dev PLUGIN=provider-aws 36 plugin-dev: generate 37 go install github.com/hashicorp/terraform/builtin/bins/$(PLUGIN) 38 mv $(GOPATH)/bin/$(PLUGIN) $(GOPATH)/bin/terraform-$(PLUGIN) 39 40 # test runs the unit tests 41 test: fmtcheck errcheck generate 42 TF_ACC= go test $(TEST) $(TESTARGS) -timeout=30s -parallel=4 43 44 # testacc runs acceptance tests 45 testacc: fmtcheck generate 46 @if [ "$(TEST)" = "./..." ]; then \ 47 echo "ERROR: Set TEST to a specific package. For example,"; \ 48 echo " make testacc TEST=./builtin/providers/aws"; \ 49 exit 1; \ 50 fi 51 TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m 52 53 test-compile: fmtcheck generate 54 @if [ "$(TEST)" = "./..." ]; then \ 55 echo "ERROR: Set TEST to a specific package. For example,"; \ 56 echo " make test-compile TEST=./builtin/providers/aws"; \ 57 exit 1; \ 58 fi 59 go test -c $(TEST) $(TESTARGS) 60 61 # testrace runs the race checker 62 testrace: fmtcheck generate 63 TF_ACC= go test -race $(TEST) $(TESTARGS) 64 65 cover: 66 @go tool cover 2>/dev/null; if [ $$? -eq 3 ]; then \ 67 go get -u golang.org/x/tools/cmd/cover; \ 68 fi 69 go test $(TEST) -coverprofile=coverage.out 70 go tool cover -html=coverage.out 71 rm coverage.out 72 73 # vet runs the Go source code static analysis tool `vet` to find 74 # any common errors. 75 vet: 76 @echo "go vet ." 77 @go vet $$(go list ./... | grep -v vendor/) ; if [ $$? -eq 1 ]; then \ 78 echo ""; \ 79 echo "Vet found suspicious constructs. Please check the reported constructs"; \ 80 echo "and fix them if necessary before submitting the code for review."; \ 81 exit 1; \ 82 fi 83 84 # generate runs `go generate` to build the dynamically generated 85 # source files. 86 generate: 87 @which stringer > /dev/null; if [ $$? -ne 0 ]; then \ 88 go get -u golang.org/x/tools/cmd/stringer; \ 89 fi 90 go generate $$(go list ./... | grep -v /terraform/vendor/) 91 @go fmt command/internal_plugin_list.go > /dev/null 92 93 fmt: 94 gofmt -w $(GOFMT_FILES) 95 96 fmtcheck: 97 @sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'" 98 99 errcheck: 100 @sh -c "'$(CURDIR)/scripts/errcheck.sh'" 101 102 .PHONY: bin default generate test vet fmt fmtcheck tools