github.com/federicobaldo/terraform@v0.6.15-0.20160323222747-b20f680cbf05/Makefile (about)

     1  TEST?=$$(go list ./... | grep -v /vendor/)
     2  VETARGS?=-all
     3  
     4  default: test vet
     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  	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 -E 'builtin|vendor')
    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  	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= 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 go test $(TEST) -v $(TESTARGS) -timeout 120m
    46  
    47  # testrace runs the race checker
    48  testrace: fmtcheck generate
    49  	TF_ACC= go test -race $(TEST) $(TESTARGS)
    50  
    51  cover:
    52  	@go tool cover 2>/dev/null; if [ $$? -eq 3 ]; then \
    53  		go get -u golang.org/x/tools/cmd/cover; \
    54  	fi
    55  	go test $(TEST) -coverprofile=coverage.out
    56  	go tool cover -html=coverage.out
    57  	rm coverage.out
    58  
    59  # vet runs the Go source code static analysis tool `vet` to find
    60  # any common errors.
    61  vet:
    62  	@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
    63  		go get golang.org/x/tools/cmd/vet; \
    64  	fi
    65  	@echo "go tool vet $(VETARGS) ."
    66  	@go tool vet $(VETARGS) $$(ls -d */ | grep -v vendor) ; if [ $$? -eq 1 ]; then \
    67  		echo ""; \
    68  		echo "Vet found suspicious constructs. Please check the reported constructs"; \
    69  		echo "and fix them if necessary before submitting the code for review."; \
    70  		exit 1; \
    71  	fi
    72  
    73  # generate runs `go generate` to build the dynamically generated
    74  # source files.
    75  generate:
    76  	@which stringer ; if [ $$? -ne 0 ]; then \
    77  	  go get -u golang.org/x/tools/cmd/stringer; \
    78  	fi
    79  	go generate $$(go list ./... | grep -v /vendor/)
    80  
    81  fmt:
    82  	gofmt -w .
    83  
    84  fmtcheck:
    85  	@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
    86  
    87  .PHONY: bin default generate test updatedeps vet fmt fmtcheck