Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
126 lines (94 loc) · 3.51 KB
/
Copy pathMakefile
File metadata and controls
126 lines (94 loc) · 3.51 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Composite targets simplify local dev scenarios
.PHONY: build
build:: ensure build_go build_sdk
.PHONY: ensure
ensure:: ensure_sdk
PKG_FILES := $(shell find pkg -name '*.go' -type f)
# Go project rooted at `pkg/` implements Pulumi Java language plugin
# and Java go as a Go library.
.PHONY: build_go
build_go: bin/pulumi-language-java bin/pulumi-java-gen
.PHONY: test_go
test_go:: build_go
cd pkg && go test ./...
bin/pulumi-language-java: ${PKG_FILES}
mkdir -p bin
cd pkg && go build -o ../bin \
-ldflags "-X github.com/pulumi/pulumi-java/pkg/version.Version=$(shell pulumictl get version)" \
github.com/pulumi/pulumi-java/pkg/cmd/pulumi-language-java
bin/pulumi-java-gen: ${PKG_FILES}
mkdir -p bin
cd pkg && go build -o ../bin \
-ldflags "-X github.com/pulumi/pulumi-java/pkg/version.Version=$(shell pulumictl get version)" \
github.com/pulumi/pulumi-java/pkg/cmd/pulumi-java-gen
.PHONY: install
install: install_sdk install_go
.PHONY: install_go
install_go: install_pulumi-language-java install_pulumi-java-gen
# Install a binary onto GOPATH
.PHONY: install_%
install_%: bin/%
cp $< $(or $(shell go env GOBIN),$(shell go env GOPATH)/bin)/$*
# Java SDK is a gradle project rooted at `sdk/java`
install_sdk::
cd sdk/java && make install
build_sdk::
cd sdk/java && make build
ensure_sdk::
cd sdk/java && make ensure
.PHONY: lint_go
lint: lint_go
lint_go: lint_pkg_dependencies
golangci-lint run -c .golangci.yml --timeout 5m
.PHONY: lint_go.fix
lint_go.fix: lint_pkg_dependencies
golangci-lint run -c .golangci.yml --timeout 5m --fix
.PHONY: lint_pkg_dependencies
lint_pkg_dependencies:
@cd pkg || exit 1; \
PKG=$$(grep -r '"github.com/pulumi/pulumi/pkg/v3/' . | grep -v 'codegen' | grep -v 'testing'); \
if [ -n "$$PKG" ] ; then \
echo "Cannot use pkg except for codegen and testing.";\
echo "Found $$PKG";\
exit 1; \
fi
# Run a custom integration test or example.
# Example: make test_example.aws-java-webserver
test_example.%: bin/pulumi-language-java
cd tests/examples && PATH="${PWD}/bin:${PATH}" go test -run "TestExamples/^$*$$"
# Test a single template, e.g.:
# make test_template.java-gradle
test_template.%: bin/pulumi-language-java
cd tests/templates && PATH="${PWD}/bin:${PATH}" go test -run "TestTemplates/^$*$$"
test_templates: bin/pulumi-language-java
cd tests/templates && PATH="${PWD}/bin:${PATH}" go test
# Test a single integration, s.g.:
# make test_integration.stack-reference
test_integration.%: bin/pulumi-language-java
cd tests/integration && PATH="${PWD}/bin:${PATH}" go test -run "TestIntegrations/^$*$$"
test_integrations: bin/pulumi-language-java
cd tests/integration && PATH="${PWD}/bin:${PATH}" go test
codegen_tests::
cd ./pkg/codegen/java && go test ./...
codegen_tests_update::
cd ./pkg/codegen/java && PULUMI_ACCEPT=true go test ./...
submodule_update::
git submodule update --init --recursive --remote
# Borrows test case schemas from pulumi/pulumi repo linked in via git
# submodule as symlinks.
borrow_schemas:: submodule_update
find pulumi/pkg/codegen/testing -name "schema.*" -exec ./scripts/borrow-schema.sh "{}" ";"
find pulumi/pkg/codegen/testing/test/testdata -maxdepth 1 -name "*-*.json" -exec ./scripts/borrow-schema.sh "{}" \;
# Runs `go mod tidy` on every Go project.
tidy::
./scripts/tidy.sh
clone_templates::
git clone https://github.com/pulumi/templates.git
clone_examples::
git clone https://github.com/pulumi/examples.git
.PHONY: changelog
changelog:
changie new
.PHONY: renovate
renovate:
./scripts/renovate-changelog.sh "$(DEP)" "$(VERSION)" "$(FILE)"