2014-09-02 18:13:55 -04:00
|
|
|
TEST?=./...
|
2013-05-07 14:39:32 -04:00
|
|
|
|
2015-08-03 14:16:17 -04:00
|
|
|
default: test vet dev
|
2013-03-23 03:48:20 -04:00
|
|
|
|
2014-09-02 18:13:55 -04:00
|
|
|
bin:
|
|
|
|
@sh -c "$(CURDIR)/scripts/build.sh"
|
2013-09-17 07:35:07 -04:00
|
|
|
|
2014-09-02 18:13:55 -04:00
|
|
|
dev:
|
|
|
|
@TF_DEV=1 sh -c "$(CURDIR)/scripts/build.sh"
|
2013-08-13 21:42:08 -04:00
|
|
|
|
2015-05-26 16:26:22 -04:00
|
|
|
# generate runs `go generate` to build the dynamically generated
|
|
|
|
# source files.
|
|
|
|
generate:
|
|
|
|
go generate ./...
|
|
|
|
|
2014-09-02 18:13:55 -04:00
|
|
|
test:
|
2015-08-06 14:02:57 -04:00
|
|
|
@echo "Running tests on:"; git symbolic-ref HEAD; git rev-parse HEAD
|
2014-09-02 18:13:55 -04:00
|
|
|
go test $(TEST) $(TESTARGS) -timeout=10s
|
2015-01-30 07:03:25 -05:00
|
|
|
@$(MAKE) vet
|
2013-07-18 10:26:36 -04:00
|
|
|
|
2015-05-26 16:26:22 -04:00
|
|
|
# testacc runs acceptance tests
|
|
|
|
testacc: generate
|
|
|
|
@if [ "$(TEST)" = "./..." ]; then \
|
|
|
|
echo "ERROR: Set TEST to a specific package"; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
PACKER_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 45m
|
|
|
|
|
2014-09-02 18:13:55 -04:00
|
|
|
testrace:
|
|
|
|
go test -race $(TEST) $(TESTARGS)
|
2013-03-24 17:47:59 -04:00
|
|
|
|
2014-09-02 18:13:55 -04:00
|
|
|
updatedeps:
|
2015-08-06 14:02:57 -04:00
|
|
|
@echo "Updating deps on:"; git symbolic-ref HEAD; git rev-parse HEAD
|
2015-06-15 16:50:01 -04:00
|
|
|
go get -u github.com/mitchellh/gox
|
|
|
|
go get -u golang.org/x/tools/cmd/stringer
|
|
|
|
go list ./... \
|
|
|
|
| xargs go list -f '{{join .Deps "\n"}}' \
|
|
|
|
| grep -v github.com/mitchellh/packer \
|
2015-07-30 19:15:55 -04:00
|
|
|
| grep -v '/internal/' \
|
2015-06-15 16:50:01 -04:00
|
|
|
| sort -u \
|
|
|
|
| xargs go get -f -u -v
|
2015-08-06 14:02:57 -04:00
|
|
|
@echo "Finished updating deps, now on:"; git symbolic-ref HEAD; git rev-parse HEAD
|
2013-03-24 17:31:18 -04:00
|
|
|
|
2015-01-30 07:03:25 -05:00
|
|
|
vet:
|
2015-08-06 14:02:57 -04:00
|
|
|
@echo "Running go vet on:"; git symbolic-ref HEAD; git rev-parse HEAD
|
2015-08-03 14:16:17 -04:00
|
|
|
@go vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
|
2015-01-30 07:03:25 -05:00
|
|
|
go get golang.org/x/tools/cmd/vet; \
|
|
|
|
fi
|
2015-08-03 14:16:17 -04:00
|
|
|
@go vet ./... ; if [ $$? -eq 1 ]; then \
|
2015-01-30 07:03:25 -05:00
|
|
|
echo ""; \
|
|
|
|
echo "Vet found suspicious constructs. Please check the reported constructs"; \
|
|
|
|
echo "and fix them if necessary before submitting the code for reviewal."; \
|
2015-06-01 18:40:43 -04:00
|
|
|
exit 1; \
|
2015-01-30 07:03:25 -05:00
|
|
|
fi
|
|
|
|
|
2015-05-26 16:26:22 -04:00
|
|
|
.PHONY: bin default generate test testacc updatedeps vet
|