diff options
author | Ævar Arnfjörð Bjarmason <avar@gitlab.com> | 2020-11-18 16:54:29 +0300 |
---|---|---|
committer | Ævar Arnfjörð Bjarmason <avar@gitlab.com> | 2020-11-18 16:54:29 +0300 |
commit | 64f8aba21618e8d475e8215875f6263a99adf613 (patch) | |
tree | 2a2eaf0605315f876b35d7664bb46da03b235eb3 | |
parent | becfc73a38c079345e58d3f5c31a3d28aa34ce2e (diff) | |
parent | b9ca5d27398e2deac37577cf0cc27fc9b8acd001 (diff) |
Merge branch 'pks-makefile-proto' into 'master'
Makefile: Improve protoc-related targets
See merge request gitlab-org/gitaly!2792
-rw-r--r-- | Makefile | 38 |
1 files changed, 19 insertions, 19 deletions
@@ -278,7 +278,7 @@ clean-ruby-vendor-go: mkdir -p ${SOURCE_DIR}/ruby/vendor && find ${SOURCE_DIR}/ruby/vendor -type f -name '*.go' -delete .PHONY: check-proto -check-proto: proto no-proto-changes +check-proto: proto no-proto-changes lint-proto .PHONY: rubocop rubocop: ${SOURCE_DIR}/.ruby-bundle @@ -312,19 +312,19 @@ docker: docker build -t gitlab/gitaly:v${GITALY_VERSION} -t gitlab/gitaly:latest ${BUILD_DIR}/docker/ .PHONY: proto -proto: ${PROTOC_GEN_GITALY} ${SOURCE_DIR}/.ruby-bundle - ${PROTOC} --gitaly_out=proto_dir=./proto,gitalypb_dir=./proto/go/gitalypb:. --go_out=paths=source_relative,plugins=grpc:./proto/go/gitalypb -I./proto ./proto/*.proto +proto: ${PROTOC} ${PROTOC_GEN_GO} ${SOURCE_DIR}/.ruby-bundle + ${Q}mkdir -p ${SOURCE_DIR}/proto/go/gitalypb + ${Q}rm -f ${SOURCE_DIR}/proto/go/gitalypb/*.pb.go + ${PROTOC} --go_out=paths=source_relative,plugins=grpc:./proto/go/gitalypb -I./proto ./proto/*.proto ${SOURCE_DIR}/_support/generate-proto-ruby ${Q}# this part is related to the generation of sources from testing proto files ${PROTOC} --plugin=${PROTOC_GEN_GO} --go_out=plugins=grpc:. internal/praefect/grpc-proxy/testdata/test.proto ${PROTOC} -I proto -I internal --plugin=${PROTOC_GEN_GO} --go_out=paths=source_relative,plugins=grpc:internal internal/middleware/cache/testdata/stream.proto ${PROTOC} -I proto --plugin=${PROTOC_GEN_GO} --go_out=paths=source_relative,plugins=grpc:proto proto/go/internal/linter/testdata/*.proto -.PHONY: proto-lint -proto-lint: ${PROTOC} ${PROTOC_GEN_GO} - ${Q}mkdir -p ${SOURCE_DIR}/proto/go/gitalypb - ${Q}rm -rf ${SOURCE_DIR}/proto/go/gitalypb/*.pb.go - ${PROTOC} --go_out=paths=source_relative:./proto/go/gitalypb -I./proto ./proto/lint.proto +.PHONY: lint-proto +lint-proto: ${PROTOC} ${PROTOC_GEN_GITALY} + ${Q}${PROTOC} --gitaly_out=proto_dir=./proto,gitalypb_dir=./proto/go/gitalypb:. -I./proto ./proto/*.proto .PHONY: no-changes no-changes: @@ -375,11 +375,6 @@ ${BUILD_DIR}/bin: | ${BUILD_DIR} ${BUILD_DIR}/go.mod: | ${BUILD_DIR} ${Q}cd ${BUILD_DIR} && go mod init _build -${PROTOC}: ${BUILD_DIR}/protoc.zip | ${BUILD_DIR} - ${Q}rm -rf ${BUILD_DIR}/protoc - ${Q}mkdir -p ${BUILD_DIR}/protoc - cd ${BUILD_DIR}/protoc && unzip ${BUILD_DIR}/protoc.zip - # This is a build hack to avoid excessive rebuilding of targets. Instead of # depending on the timestamp of the Makefile, which will change e.g. between # jobs of a CI pipeline, we start depending on its hash. Like this, we only @@ -423,24 +418,29 @@ ${GIT_INSTALL_DIR}/bin/git: ${BUILD_DIR}/git_full_bins.tgz tar -C ${GIT_INSTALL_DIR} -xvzf ${BUILD_DIR}/git_full_bins.tgz endif +${PROTOC}: ${BUILD_DIR}/protoc.zip | ${BUILD_DIR} + ${Q}rm -rf ${BUILD_DIR}/protoc + ${Q}mkdir -p ${BUILD_DIR}/protoc + cd ${BUILD_DIR}/protoc && unzip ${BUILD_DIR}/protoc.zip + +${GITALYFMT}: | ${BUILD_DIR}/bin + ${Q}go build -o $@ ${SOURCE_DIR}/internal/cmd/gitalyfmt + +${PROTOC_GEN_GITALY}: proto | ${BUILD_DIR}/bin + ${Q}go build -o $@ ${SOURCE_DIR}/proto/go/internal/cmd/protoc-gen-gitaly + ${GOCOVER_COBERTURA}: ${BUILD_DIR}/Makefile.sha256 ${Q}cd ${BUILD_DIR} && go get github.com/t-yuki/gocover-cobertura@${GOCOVER_COBERTURA_VERSION} ${GO_JUNIT_REPORT}: ${BUILD_DIR}/Makefile.sha256 ${BUILD_DIR}/go.mod ${Q}cd ${BUILD_DIR} && go get github.com/jstemmer/go-junit-report@984a47ca6b0a7d704c4b589852051b4d7865aa17 -${GITALYFMT}: | ${BUILD_DIR}/bin - ${Q}go build -o $@ ${SOURCE_DIR}/internal/cmd/gitalyfmt - ${GO_LICENSES}: ${BUILD_DIR}/Makefile.sha256 ${BUILD_DIR}/go.mod ${Q}cd ${BUILD_DIR} && go get github.com/google/go-licenses@73411c8fa237ccc6a75af79d0a5bc021c9487aad ${PROTOC_GEN_GO}: ${BUILD_DIR}/Makefile.sha256 ${BUILD_DIR}/go.mod ${Q}cd ${BUILD_DIR} && go get github.com/golang/protobuf/protoc-gen-go@v${PROTOC_GEN_GO_VERSION} -${PROTOC_GEN_GITALY}: ${BUILD_DIR}/go.mod proto-lint - ${Q}go build -o $@ gitlab.com/gitlab-org/gitaly/proto/go/internal/cmd/protoc-gen-gitaly - ${GOLANGCI_LINT}: ${BUILD_DIR}/Makefile.sha256 ${BUILD_DIR}/go.mod ${Q}cd ${BUILD_DIR} && go get github.com/golangci/golangci-lint/cmd/golangci-lint@v${GOLANGCI_LINT_VERSION} |