/
Makefile
69 lines (58 loc) · 2.03 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
export PATH = $(shell echo $$PWD/bin:$$PATH)
all:
@echo "*****************************************"
@echo "** WebRPC Dev **"
@echo "*****************************************"
@echo "make <cmd>"
@echo ""
@echo "commands:"
@echo ""
@echo " + Testing:"
@echo " - test"
@echo " - generate"
@echo " - diff"
@echo ""
@echo " + Builds:"
@echo " - build"
@echo " - build-test"
@echo " - clean"
@echo " - install"
@echo ""
@echo " + Dep management:"
@echo " - dep"
@echo " - dep-upgrade-all"
@echo ""
build:
go build -ldflags="-s -w -X github.com/webrpc/webrpc.VERSION=$$(git describe --tags)" -o ./bin/webrpc-gen ./cmd/webrpc-gen
build-test:
go build -ldflags="-s -w -X github.com/webrpc/webrpc.VERSION=$$(git describe --tags)" -o ./bin/webrpc-test ./cmd/webrpc-test
clean:
rm -rf ./bin
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
generate: build
go generate -v -x ./...
cd _examples/ && go generate -x ./...
@for i in _examples/*/Makefile; do \
echo; echo $$ cd $$(dirname $$i) \&\& make generate; \
cd $$(dirname $$i); \
make generate || exit 1; \
cd ../../; \
done
# Replace webrpc version in all generated files to avoid git conflicts.
git grep -l "$$(git describe --tags)" | xargs sed -i -e "s/@$$(git describe --tags)//g"
sed -i "/$$(git describe --tags)/d" tests/schema/test.debug.gen.txt
dep-upgrade-all:
go get -u go@1.19 ./...
diff:
git diff --color --ignore-all-space --ignore-blank-lines --exit-code
test: test-go test-interoperability
test-go: generate
go test -v ./...
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