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