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