-
Notifications
You must be signed in to change notification settings - Fork 11
/
GNUmakefile
65 lines (51 loc) · 1.93 KB
/
GNUmakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
HOSTNAME=localhost
NAMESPACE=backblaze
NAME=b2
BINARY=terraform-provider-${NAME}
VERSION=$(shell git describe --tags --abbrev=0 | cut -c2-)
OS_ARCH=$(shell go env GOOS)_$(shell go env GOARCH)
default: build
.PHONY: _pybindings deps deps-check format lint testacc clean build install docs docs-lint
_pybindings:
ifeq ($(origin NOPYBINDINGS), undefined)
@$(MAKE) -C python-bindings $(MAKECMDGOALS)
else
$(info Skipping python bindings (NOPYBINDINGS is defined))
endif
deps: _pybindings
@go mod download
@go mod tidy
@cd tools && go mod download
@cd tools && go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
@cd tools && go mod tidy
deps-check:
@go mod tidy
@cd tools && go mod tidy
@git diff --exit-code -- go.mod go.sum tools/go.mod tools/go.sum || \
(echo; echo "Unexpected difference in go.mod/go.sum files. Run 'make deps' command or revert any go.mod/go.sum changes and commit."; exit 1)
format: _pybindings
@go fmt ./...
@terraform fmt -recursive ./examples/
lint: _pybindings
@python scripts/check-gofmt.py '**/*.go' pkged.go
@python scripts/check-headers.py '**/*.go' pkged.go
testacc: _pybindings
@cp python-bindings/dist/py-terraform-provider-b2 b2/
@chmod +rx b2/py-terraform-provider-b2
TF_ACC=1 go test ./${NAME} -v -count 1 -parallel 4 -timeout 120m $(TESTARGS)
clean: _pybindings
@rm -rf dist b2/py-terraform-provider-b2 ${BINARY}
build: _pybindings
@cp python-bindings/dist/py-terraform-provider-b2 b2/
@go build -tags netgo -o ${BINARY}
install: build
@mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
@mv ${BINARY} ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
docs: build
@tfplugindocs
docs-lint: build
@tfplugindocs validate
@tfplugindocs
@git diff --exit-code -- docs/ || \
(echo; echo "Unexpected difference in docs. Run 'make docs' command or revert any changes in the schema."; exit 1)
all: deps lint build testacc