-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (59 loc) · 2.75 KB
/
Copy pathMakefile
File metadata and controls
72 lines (59 loc) · 2.75 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
export PATH = $(shell echo $$PWD/bin:$$PATH)
all:
@echo "****************************************"
@echo "** webrpc **"
@echo "****************************************"
@echo "make <cmd>"
@echo ""
@echo "commands:"
@awk -F'[ :]' '/^#+/ {comment=$$0; gsub(/^#+[ ]*/, "", comment)} !/^(_|all:)/ && /^([A-Za-z_-]+):/ && !seen[$$1]++ {printf " %-24s %s\n", $$1, (comment ? "- " comment : ""); comment=""} !/^#+/ {comment=""}' Makefile
# Build webrpc-gen
build:
go build -ldflags="-s -w -X github.com/webrpc/webrpc.VERSION=$$(git describe --tags)" -o ./bin/webrpc-gen ./cmd/webrpc-gen
# Build webrpc-test
build-test:
go build -ldflags="-s -w -X github.com/webrpc/webrpc.VERSION=$$(git describe --tags)" -o ./bin/webrpc-test ./cmd/webrpc-test
# Install webrpc-gen and webrpc-test binaries locally
install:
go install -ldflags="-s -w -X github.com/webrpc/webrpc.VERSION=$$(git describe --tags)" ./cmd/webrpc-gen
go install -ldflags="-s -w -X github.com/webrpc/webrpc.VERSION=$$(git describe --tags)" ./cmd/webrpc-test
clean:
rm -rf ./bin
# Regenerate examples and tests using latest templates (see go.mod)
generate: build
go generate -v -x ./...
for i in _examples/*; do echo $$i; make -C $$i generate || exit 1; done
# Replace webrpc version in all generated files to avoid git conflicts.
git grep -l "$$(git describe --tags)" | xargs perl -i -pe "s/\@$$(git describe --tags)//g"
perl -i -ne "print unless /$$(git describe --tags)/" tests/schema/test.debug.gen.txt
# Strip code-generator versions (gen-<name>@vX.Y.Z) from generated files so dependency bumps don't churn them.
git grep -lE "gen-[a-z]+@v[0-9]" -- _examples tests | xargs perl -i -pe 's/(gen-[a-z]+)\@v[0-9][0-9.]*/$$1/g'
# Upgrade Go dependencies
dep-upgrade-all:
go get -u go@1.25 ./...
dep-upgrade-templates:
go get github.com/webrpc/gen-dart@latest
go get github.com/webrpc/gen-golang@latest
go get github.com/webrpc/gen-javascript@latest
go get github.com/webrpc/gen-kotlin@latest
go get github.com/webrpc/gen-openapi@latest
go get github.com/webrpc/gen-typescript@latest
# Run git diff and fail on any local changes
diff:
git diff --color --ignore-all-space --ignore-blank-lines --exit-code
# Run all tests
test: test-go test-interoperability
# Run Go tests
test-go: generate
go test -v ./...
# Run interoperability test suite
test-interoperability: build-test
echo "Running interoperability test suite"; \
./bin/webrpc-test -server -port=9988 -timeout=2s & \
until nc -z localhost 9988; do sleep 0.1; done; \
./bin/webrpc-test -client -url=http://localhost:9988; \
wait
# Update ridl golden examples
update-ridl-test-golden-examples:
cd ./schema/ridl && go test -update=./_example/example1-golden.json
cd ./schema/ridl && go test -update=./_example/example2-golden.json