Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-10-28 09:03:52 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-10-28 09:10:02 +0300
commit43fe495289974aa25c758018b300f9420c485870 (patch)
treec1402a735a5be1fcef71672e1673db9812f37d6c /Makefile
parent49d098476b160a2c938eed0d0cd1616c8dd5d9a6 (diff)
tools/protogem: Generate Protobuf sources ad-hoc when building Gem
The Ruby sidecar is slowly nearing its end: right now, it only implements a single RPC that is in the process of being migrated to Go. This means we'll start to soon remove all the Ruby infrastructure in the Gitaly project. Part of the infrastructure is the Ruby code generated from our Protobuf definitions. And while we won't need that code ourselves anymore, it is important for clients written in Ruby that want to interface with us. As such, the Gitaly project still has to release the `gitaly` Gem. In the past, we built the Gem by simply soaking up the code in `ruby/proto`. But as it does not make any sense for us to keep the Ruby code around anymore this strategy will fail once we have removed it. Merge the `generate-proto-ruby` any `publish-gem` scripts into a single script that: 1. Generates all required Ruby sources into a temporary directory. 2. Writes the `gitaly.gemspec` file into the same directory. 3. Builds the Gitaly Gem from those temporary files. Like this, all code is generated ad-hoc and doesn't need to be committed to the repository anymore. Change the Makefile's `proto` target to not generate Ruby code anymore. Instead, there are two new Makefile targets `build-proto-gem` and `publish-proto-gem` that are responsible for building and publishing the Gem, respecfively. The generated Ruby code is thus stale now and will be removed in a subsequent commit.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile15
1 files changed, 12 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index c1d9307c7..e797a75e2 100644
--- a/Makefile
+++ b/Makefile
@@ -483,11 +483,10 @@ cover: prepare-tests libgit2 ${GOCOVER_COBERTURA}
.PHONY: proto
## Regenerate protobuf definitions.
proto: SHARED_PROTOC_OPTS = --plugin=${PROTOC_GEN_GO} --plugin=${PROTOC_GEN_GO_GRPC} --plugin=${PROTOC_GEN_GITALY_PROTOLIST} --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative
-proto: ${PROTOC} ${PROTOC_GEN_GO} ${PROTOC_GEN_GO_GRPC} ${PROTOC_GEN_GITALY_PROTOLIST} ${SOURCE_DIR}/.ruby-bundle
+proto: ${PROTOC} ${PROTOC_GEN_GO} ${PROTOC_GEN_GO_GRPC} ${PROTOC_GEN_GITALY_PROTOLIST}
${Q}mkdir -p ${SOURCE_DIR}/proto/go/gitalypb
${Q}rm -f ${SOURCE_DIR}/proto/go/gitalypb/*.pb.go
${PROTOC} ${SHARED_PROTOC_OPTS} -I ${SOURCE_DIR}/proto -I ${PROTOC_INSTALL_DIR}/include --go_out=${SOURCE_DIR}/proto/go/gitalypb --gitaly-protolist_out=proto_dir=${SOURCE_DIR}/proto,gitalypb_dir=${SOURCE_DIR}/proto/go/gitalypb:${SOURCE_DIR} --go-grpc_out=${SOURCE_DIR}/proto/go/gitalypb ${SOURCE_DIR}/proto/*.proto
- ${SOURCE_DIR}/tools/protogem/generate-proto-ruby
@ # this part is related to the generation of sources from testing proto files
${PROTOC} ${SHARED_PROTOC_OPTS} -I ${SOURCE_DIR}/proto -I ${SOURCE_DIR}/internal -I ${PROTOC_INSTALL_DIR}/include --go_out=${SOURCE_DIR}/internal --go-grpc_out=${SOURCE_DIR}/internal \
${SOURCE_DIR}/internal/praefect/mock/mock.proto \
@@ -504,13 +503,23 @@ lint-proto: ${PROTOC} ${PROTOLINT} ${PROTOC_GEN_GITALY_LINT}
${Q}${PROTOC} -I ${SOURCE_DIR}/proto -I ${PROTOC_INSTALL_DIR}/include --plugin=${PROTOC_GEN_GITALY_LINT} --gitaly-lint_out=${SOURCE_DIR} ${SOURCE_DIR}/proto/*.proto
${Q}${PROTOLINT} lint -config_dir_path=${SOURCE_DIR}/proto ${SOURCE_DIR}/proto
+.PHONY: build-proto-gem
+## Build the Ruby Gem that contains Gitaly's Protobuf definitons.
+build-proto-gem:
+ ${Q}"${SOURCE_DIR}"/tools/protogem/generate-proto-ruby "${BUILD_DIR}/gitaly.gem"
+
+.PHONY: publish-proto-gem
+## Build and publish the Ruby Gem that contains Gitaly's Protobuf definitons.
+publish-proto-gem: build-proto-gem
+ ${Q}gem push "${BUILD_DIR}/gitaly.gem"
+
.PHONY: no-changes
no-changes:
${Q}${GIT} diff --exit-code
.PHONY: no-proto-changes
no-proto-changes: proto | ${BUILD_DIR}
- ${Q}${GIT} diff --exit-code -- '*.pb.go' 'ruby/proto/gitaly'
+ ${Q}${GIT} diff --exit-code -- '*.pb.go'
.PHONY: dump-database-schema
## Dump the clean database schema of Praefect into a file.