Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makefile cleanup / codegen revamp / gobin removed (#3903)
A few "safe" / simple changes to the Makefile, in prep for future changes. Specifically, this includes: - made `// ` (with trailing space) license comments into `//` so they do not conflict with `goimports` - moving "build" to ".build" so it's hidden and automatically ignored by most things. - in particular this _slightly_ improves the odds that the first build (no build-folder at parse time) and the Nth build (build folder already exists) behave the same, as e.g. `ALL_SRC` will implicitly ignore it now. - `ifndef` -> `?=` because that's basically what they're doing. - this does mean that `go env GOOS` may run multiple times, as `?=` acts like `=` and not `:=`, but it's fast enough to not be noticeable (single-digit ms). - I did not change `TEST_TAG`, as the `override` is needed to modify the var when it's set via `make TEST_TAG=adsf targets...` - `ALL_SRC` now uses a find query that does not even descend into vendor / etc, rather than filtering them out afterward. - this is visibly faster when the files are not in caches, and will essentially remain fast regardless of how large the project grows. - future changes can just modify the find filter (it's pretty simple) or add a `grep -v` to the end like before. - got rid of `TOOLS_SRC` because it was completely incorrect: the tools bins depend on cadence source outside of the tools folder. - the copyright bin is the only exception, and its target dependency doesn't use `TOOLS_SRC` anyway. - revamped how thrift sources are generated: - `*.thrift` files are found rather than listed. guaranteed to be complete + smaller = perhaps better than a handwritten list. - switched to using a "normal" multi-target rule rather than define+foreach+eval+call. hopefully this is simpler to understand and modify. - `--no-recurse` + separate target files = you can safely generate thrift in parallel! try `touch idls/thrift/cadence.thrift` + `make .gen/go/cadence/cadence.go -j8` to see this in action. - `make -j8` in general does not yet work though, as other dependencies are not declared correctly, e.g. copyright is not run when appropriate. that's a goal for later commits... - got rid of `gobin`, now using go.mod - this approach keeps runtime-library-versions in sync with codegen-library-versions, which is important for some libraries, like yarpc and mockgen. - other tools _could_ be moved to a separately-versioned tools.mod for greater flexibility, but that is not done here. - I have not yet adapted the protobuf changes, but will do that soon - to update tools, `go get -u` them, like normal. to add tools, add them to `cmd/server/tools.go` (this file will probably be moved soon) - some changes to protoc to align it with everything else - minor cleanup of the buildkite dockerfile + adding `unzip` because now it's needed. I suspect there's a lot more possible here, but I haven't explored. After pulling, you'll need to manually delete your `build` folder. Generated code / copyright headers / etc should all be identical after this change, though the actual golint / yarpc / etc binaries are not necessarily _identical_ due to incomplete versioning before.
- Loading branch information