-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
96 lines (70 loc) · 2.87 KB
/
Makefile
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
# Composite targets simplify local dev scenarios
build:: ensure build_go build_sdk
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.
build_go::
cd pkg && go build -v all
test_go:: build_go submodule_update
cd pkg && go test ./...
bin/pulumi-language-java: ${PKG_FILES}
mkdir -p bin
cd pkg && go build -o ../bin 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 --tag-pattern '^pkg')" github.com/pulumi/pulumi-java/pkg/cmd/pulumi-java-gen
# 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_pkg
lint:: lint_pkg
lint_pkg: lint_pkg_dependencies
cd pkg && golangci-lint run -c ../.golangci.yml --timeout 5m
.PHONY: lint_pkg_dependencies
lint_pkg_dependencies:
@cd pkg || exit 1; \
PKG=$$(grep -r '"github.com/pulumi/pulumi/pkg/v3/[^codegen]' .); \
if [ "$$?" -eq 0 ] ; then \
echo "Cannot use pkg except for codegen.";\
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.v
# 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.v
test_templates: bin/pulumi-language-java
cd tests/templates && PATH="${PWD}/bin:${PATH}" go test -test.v
# 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.v
test_integrations: bin/pulumi-language-java
cd tests/integration && PATH="${PWD}/bin:${PATH}" go test -test.v
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