@@ -23,11 +23,10 @@ SRCS := $(foreach pkg,$(PKGS),$(wildcard $(pkg)/*.go))
2323
2424PLATFORM := $(shell uname -s | tr '[:upper:]' '[:lower:]')
2525ARCH := $(shell uname -m)
26- THRIFT_REL := ./scripts/travis/thrift-release/$(PLATFORM ) -$(ARCH )
2726
2827OLD_GOPATH := $(GOPATH )
2928
30- export PATH := $(realpath $( THRIFT_REL ) ) : $( PATH )
29+ BIN := $(shell pwd) /.bin
3130
3231# Cross language test args
3332TEST_HOST =127.0.0.1
@@ -37,6 +36,10 @@ TEST_PORT=0
3736
3837all : test examples
3938
39+ $(BIN ) /thrift :
40+ mkdir -p $(BIN )
41+ scripts/install-thrift.sh $(BIN )
42+
4043packages_test :
4144 go list -json ./... | jq -r ' . | select ((.TestGoFiles | length) > 0) | .ImportPath'
4245
4649 mkdir -p $(THRIFT_GEN_RELEASE_LINUX )
4750 mkdir -p $(THRIFT_GEN_RELEASE_DARWIN )
4851
49- get_thrift :
50- scripts/travis/get-thrift.sh
51-
5252# We want to remove `vendor` dir because thrift-gen tests don't work with it.
5353# However, glide install even with --cache-gopath option leaves GOPATH at HEAD,
5454# not at the desired versions from glide.lock, which are only applied to `vendor`
@@ -70,7 +70,7 @@ install_glide:
7070 # but have to pin to 0.12.3 due to https://github.com/Masterminds/glide/issues/745
7171 GOPATH=$(OLD_GOPATH ) go get -u github.com/Masterminds/glide && cd $(OLD_GOPATH ) /src/github.com/Masterminds/glide && git checkout v0.12.3 && go install
7272
73- install_ci : install_glide install_lint get_thrift install
73+ install_ci : $( BIN ) /thrift install_glide install_lint install
7474 GOPATH=$(OLD_GOPATH ) go get -u github.com/mattn/goveralls
7575ifdef CROSSDOCK
7676 $(MAKE) install_docker_ci
@@ -100,23 +100,23 @@ else
100100 $(MAKE) test
101101endif
102102
103- test : clean setup install_test check_no_test_deps
103+ test : clean setup install_test check_no_test_deps $( BIN ) /thrift
104104 @echo Testing packages:
105- go test -parallel=4 $(TEST_ARG ) $(ALL_PKGS )
105+ PATH= $( BIN ) : $$ PATH go test -parallel=4 $(TEST_ARG ) $(ALL_PKGS )
106106 @echo Running frame pool tests
107- go test -run TestFramesReleased -stressTest $(TEST_ARG )
107+ PATH= $( BIN ) : $$ PATH go test -run TestFramesReleased -stressTest $(TEST_ARG )
108108
109109check_no_test_deps :
110110 ! go list -json $(PROD_PKGS ) | jq -r .Deps[] | grep -e test -e mock
111111
112- benchmark : clean setup
112+ benchmark : clean setup $( BIN ) /thrift
113113 echo Running benchmarks:
114- go test $(ALL_PKGS ) -bench=. -cpu=1 -benchmem -run NONE
114+ PATH= $( BIN ) :: $$ PATH go test $(ALL_PKGS ) -bench=. -cpu=1 -benchmem -run NONE
115115
116- cover_profile : clean setup
116+ cover_profile : clean setup $( BIN ) /thrift
117117 @echo Testing packages:
118118 mkdir -p $(BUILD )
119- go test ./ $(TEST_ARG ) -coverprofile=$(BUILD ) /coverage.out
119+ PATH= $( BIN ) :: $$ PATH go test ./ $(TEST_ARG ) -coverprofile=$(BUILD ) /coverage.out
120120
121121cover : cover_profile
122122 go tool cover -html=$(BUILD ) /coverage.out
@@ -167,18 +167,18 @@ examples: clean setup thrift_example
167167 go build -o $(BUILD ) /examples/bench/runner ./examples/bench/runner.go
168168 go build -o $(BUILD ) /examples/test_server ./examples/test_server
169169
170- thrift_gen :
170+ thrift_gen : $( BIN ) /thrift
171171 go build -o $(BUILD ) /thrift-gen ./thrift/thrift-gen
172- $(BUILD ) /thrift-gen --generateThrift --inputFile thrift/test.thrift --outputDir thrift/gen-go/
173- $(BUILD ) /thrift-gen --generateThrift --inputFile examples/keyvalue/keyvalue.thrift --outputDir examples/keyvalue/gen-go
174- $(BUILD ) /thrift-gen --generateThrift --inputFile examples/thrift/example.thrift --outputDir examples/thrift/gen-go
175- $(BUILD ) /thrift-gen --generateThrift --inputFile hyperbahn/hyperbahn.thrift --outputDir hyperbahn/gen-go
172+ PATH= $( BIN ) : $$ PATH $(BUILD ) /thrift-gen --generateThrift --inputFile thrift/test.thrift --outputDir thrift/gen-go/
173+ PATH= $( BIN ) : $$ PATH $(BUILD ) /thrift-gen --generateThrift --inputFile examples/keyvalue/keyvalue.thrift --outputDir examples/keyvalue/gen-go
174+ PATH= $( BIN ) : $$ PATH $(BUILD ) /thrift-gen --generateThrift --inputFile examples/thrift/example.thrift --outputDir examples/thrift/gen-go
175+ PATH= $( BIN ) : $$ PATH $(BUILD ) /thrift-gen --generateThrift --inputFile hyperbahn/hyperbahn.thrift --outputDir hyperbahn/gen-go
176176
177177release_thrift_gen : clean setup
178178 GOOS=linux GOARCH=amd64 go build -o $(THRIFT_GEN_RELEASE_LINUX ) /thrift-gen ./thrift/thrift-gen
179179 GOOS=darwin GOARCH=amd64 go build -o $(THRIFT_GEN_RELEASE_DARWIN ) /thrift-gen ./thrift/thrift-gen
180180 tar -czf thrift-gen-release.tar.gz $(THRIFT_GEN_RELEASE )
181181 mv thrift-gen-release.tar.gz $(THRIFT_GEN_RELEASE ) /
182182
183- .PHONY : all help clean fmt format get_thrift install install_ci install_lint install_glide release_thrift_gen packages_test check_no_test_deps test test_ci lint
183+ .PHONY : all help clean fmt format install install_ci install_lint install_glide release_thrift_gen packages_test check_no_test_deps test test_ci lint
184184.SILENT : all help clean fmt format test lint
0 commit comments