diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-11-10 12:24:53 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-11-14 11:16:08 +0300 |
commit | 01625a5d16cd016512ce69535366fed9e05ba003 (patch) | |
tree | c74e9c631e8ea314de0422f1e27081cb675b755f /Makefile | |
parent | 8d71600be364ab06185d833d5fb9674d3270bb07 (diff) |
Makefile: Fix race in `no-proto-changes` target
The `no-proto-changes` target first regenerates the Protobuf files and
then checks whether there are any changes compared to the Protobuf
definitions. To regenerate the files, we first delete the target
directory that contains the generated code so that we start from a clean
slate. This is causing problems though when this target is executed via
`make verify`, which besides other targets also executes the `lint`
target. Now if the code is getting deleted while the linter runs in
parallel then it may happen that linting fails due to the missing code.
Now that we have the ability to generate Protobuf code in a different
directory thoulgh this is easy to fix. Instead of modifying our source
directory, we can just generate Protobuf files in our build directory
and compare this directory with our sources. Like this, actual source
files files will never get deleted and thus the linter will be happy.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -507,8 +507,9 @@ no-changes: ${Q}${GIT} diff --exit-code .PHONY: no-proto-changes +no-proto-changes: PROTO_DEST_DIR := ${BUILD_DIR}/proto-changes no-proto-changes: proto | ${BUILD_DIR} - ${Q}${GIT} diff --exit-code -- '*.pb.go' + ${Q}${GIT} diff --no-index --exit-code -- "${PROTO_DEST_DIR}" "${SOURCE_DIR}/proto/go" .PHONY: dump-database-schema ## Dump the clean database schema of Praefect into a file. |