Commit bbc380f
Clean up / optimize makefile, sandbox builds better. (#474)
- Removed a bunch of cruft from overly-generic makefile copypasta
(many of it doesn't do anything here, and makes it harder to read).
- Corrected a number of dependency chains. Let me know if I missed
something! I've tried to be thorough, but it's hard to be sure.
in any case, now it shouldn't re-do work unless it's necessary, and
it can even init in parallel (`make -j4`) from a fresh clone without
any problems I've seen.
- I was unable to trick Glide into including the necessary packages / versions
to reliably build things out of vendor... so now there's a `versioned_go_build.sh`
script to do that. It'll also warn you if there's a newer version of tool X
available.
- Dep can do this pretty easily, add the target command to `require`... though
I'm not sure what that implies for users-of-this-lib. Can investigate later.
- If you change the version vars, it'll automatically build the new version and
rerun as needed. And they're not removed with `make clean`, which helps
keep you from needing to be online to build tools.
- Last but not least: `go test ./...` is equivalent to (or better than)
testing each package separately, and is often *much* faster because it
doesn't spend time rebuilding everything. And now that we're on Go 1.10, it can
do coverage across all packages too!
---
Before all changes:
```
$ make clean
rm -rf cadence-client
rm -Rf ./build
rm -f dummy
$ time make
rm -rf .gen
go get './vendor/go.uber.org/thriftrw'
go get './vendor/go.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc'
thriftrw --plugin=yarpc --pkg-prefix=go.uber.org/cadence/.gen/go/ --out=.gen/go idl/github.com/uber/cadence/cadence.thrift
thriftrw --plugin=yarpc --pkg-prefix=go.uber.org/cadence/.gen/go/ --out=.gen/go idl/github.com/uber/cadence/shared.thrift
go run ./internal/cmd/tools/copyright/licensegen.go --verifyOnly
go build -i -o dummy internal/cmd/dummy/dummy.go
ok go.uber.org/cadence/internal 4.175s coverage: 66.6% of statements
ok go.uber.org/cadence/internal/common/backoff 1.046s coverage: 93.2% of statements
ok go.uber.org/cadence/internal/common/cache 1.462s coverage: 73.1% of statements
ok go.uber.org/cadence/internal/common/metrics 1.055s coverage: 85.0% of statements
ok go.uber.org/cadence/internal/common/util 1.024s coverage: 5.2% of statements
ok go.uber.org/cadence/mocks 1.037s coverage: 6.7% of statements
real 0m20.177s
user 0m11.994s
sys 0m5.099s
$ time make
rm -rf .gen
go get './vendor/go.uber.org/thriftrw'
go get './vendor/go.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc'
thriftrw --plugin=yarpc --pkg-prefix=go.uber.org/cadence/.gen/go/ --out=.gen/go idl/github.com/uber/cadence/cadence.thrift
thriftrw --plugin=yarpc --pkg-prefix=go.uber.org/cadence/.gen/go/ --out=.gen/go idl/github.com/uber/cadence/shared.thrift
go run ./internal/cmd/tools/copyright/licensegen.go --verifyOnly
ok go.uber.org/cadence/internal 4.177s coverage: 66.8% of statements
ok go.uber.org/cadence/internal/common/backoff 1.046s coverage: 93.2% of statements
ok go.uber.org/cadence/internal/common/cache 1.460s coverage: 73.1% of statements
ok go.uber.org/cadence/internal/common/metrics 1.051s coverage: 85.0% of statements
ok go.uber.org/cadence/internal/common/util 1.027s coverage: 5.2% of statements
ok go.uber.org/cadence/mocks 1.038s coverage: 6.7% of statements
real 0m18.736s
user 0m10.713s
sys 0m4.605s
```
After all changes:
```
$ make clean
rm -Rf .build
rm -Rf .gen
$ time make
./versioned_go_build.sh go.uber.org/thriftrw v1.11.0 .build/thriftrw
./versioned_go_build.sh go.uber.org/yarpc v1.29.1 encoding/thrift/thriftrw-plugin-yarpc .build/thriftrw-plugin-yarpc
go.uber.org/yarpc has a newer tag: v1.30.0
thriftrw: idl/github.com/uber/cadence/cadence.thrift
go run ./internal/cmd/tools/copyright/licensegen.go --verifyOnly
touch .build/copyright
go build -i -o .build/dummy internal/cmd/dummy/dummy.go
go test ./... -coverprofile=.build/cover.out -race
? go.uber.org/cadence [no test files]
? go.uber.org/cadence/activity [no test files]
? go.uber.org/cadence/client [no test files]
? go.uber.org/cadence/encoded [no test files]
ok go.uber.org/cadence/internal 4.188s coverage: 66.8% of statements
? go.uber.org/cadence/internal/cmd/dummy [no test files]
? go.uber.org/cadence/internal/cmd/tools/copyright [no test files]
? go.uber.org/cadence/internal/common [no test files]
ok go.uber.org/cadence/internal/common/backoff 1.060s coverage: 93.2% of statements
ok go.uber.org/cadence/internal/common/cache 1.490s coverage: 73.1% of statements
ok go.uber.org/cadence/internal/common/metrics 1.065s coverage: 85.0% of statements
ok go.uber.org/cadence/internal/common/util 1.037s coverage: 5.2% of statements
ok go.uber.org/cadence/mocks 1.048s coverage: 6.7% of statements
? go.uber.org/cadence/testsuite [no test files]
? go.uber.org/cadence/worker [no test files]
? go.uber.org/cadence/workflow [no test files]
real 0m34.329s
user 0m25.309s
sys 0m18.131s
$ time make
go test ./... -coverprofile=.build/cover.out -race
? go.uber.org/cadence [no test files]
? go.uber.org/cadence/activity [no test files]
? go.uber.org/cadence/client [no test files]
? go.uber.org/cadence/encoded [no test files]
ok go.uber.org/cadence/internal 4.175s coverage: 66.8% of statements
? go.uber.org/cadence/internal/cmd/dummy [no test files]
? go.uber.org/cadence/internal/cmd/tools/copyright [no test files]
? go.uber.org/cadence/internal/common [no test files]
ok go.uber.org/cadence/internal/common/backoff 1.062s coverage: 93.2% of statements
ok go.uber.org/cadence/internal/common/cache 1.500s coverage: 73.1% of statements
ok go.uber.org/cadence/internal/common/metrics 1.060s coverage: 85.0% of statements
ok go.uber.org/cadence/internal/common/util 1.034s coverage: 5.2% of statements
ok go.uber.org/cadence/mocks 1.042s coverage: 6.7% of statements
? go.uber.org/cadence/testsuite [no test files]
? go.uber.org/cadence/worker [no test files]
? go.uber.org/cadence/workflow [no test files]
real 0m6.635s
user 0m8.372s
sys 0m2.819s
```
So the net effect is a slightly slower initial build, and a much faster second+ build.
Seems worth it :)1 parent 87a4ffa commit bbc380f
3 files changed
+249
-73
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | 2 | | |
8 | 3 | | |
9 | 4 | | |
10 | 5 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
16 | 12 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
20 | 17 | | |
21 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
22 | 26 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 27 | + | |
| 28 | + | |
30 | 29 | | |
31 | | - | |
32 | | - | |
33 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
34 | 33 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
39 | 37 | | |
40 | | - | |
41 | | - | |
| 38 | + | |
| 39 | + | |
42 | 40 | | |
43 | | - | |
44 | | - | |
| 41 | + | |
| 42 | + | |
45 | 43 | | |
46 | | - | |
47 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
48 | 49 | | |
49 | | - | |
50 | | - | |
51 | | - | |
| 50 | + | |
| 51 | + | |
52 | 52 | | |
53 | | - | |
54 | | - | |
| 53 | + | |
| 54 | + | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 58 | + | |
62 | 59 | | |
63 | 60 | | |
64 | 61 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
74 | 72 | | |
75 | | - | |
| 73 | + | |
| 74 | + | |
76 | 75 | | |
77 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
78 | 79 | | |
79 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
80 | 88 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
| 89 | + | |
87 | 90 | | |
88 | | - | |
| 91 | + | |
89 | 92 | | |
90 | 93 | | |
91 | | - | |
| 94 | + | |
92 | 95 | | |
93 | 96 | | |
94 | 97 | | |
95 | | - | |
96 | | - | |
97 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
98 | 101 | | |
99 | 102 | | |
100 | | - | |
| 103 | + | |
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
104 | 107 | | |
105 | | - | |
| 108 | + | |
106 | 109 | | |
107 | 110 | | |
108 | | - | |
109 | | - | |
| 111 | + | |
| 112 | + | |
110 | 113 | | |
111 | 114 | | |
112 | 115 | | |
| |||
121 | 124 | | |
122 | 125 | | |
123 | 126 | | |
124 | | - | |
125 | 127 | | |
126 | | - | |
| 128 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
0 commit comments