From 065f5228f46e1bdc4cc5fdb4efcc61bdd529bba8 Mon Sep 17 00:00:00 2001 From: Divya Rani <drani@gitlab.com> Date: Wed, 19 Mar 2025 12:57:26 +0530 Subject: [PATCH] make: Update build-proto-gem In this MR - https://gitlab.com/gitlab-org/gitaly/-/merge_requests/7561 we introduced etcd's raftpb as a dependencyof gitalypb. This commit updates the "make build-proto-gem" pipeline to include raftpb and it's dependencies --- Makefile | 4 ++-- tools/protogem/build-proto-gem | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3595ca44f9..d552e92500 100644 --- a/Makefile +++ b/Makefile @@ -538,11 +538,11 @@ lint-proto: ${PROTOC} ${PROTOLINT} ${PROTOC_GEN_GITALY_LINT} proto .PHONY: build-proto-gem ## Build the Ruby Gem that contains Gitaly's Protobuf definitions. -build-proto-gem: +build-proto-gem: ${DEPENDENCY_DIR}/raftpb ${Q}rm -rf "${BUILD_DIR}/${BUILD_GEM_NAME}.gem" && mkdir -p ${BUILD_DIR} ${Q}rm -rf "${BUILD_DIR}/${BUILD_GEM_NAME}-gem" && mkdir -p ${BUILD_DIR}/${BUILD_GEM_NAME}-gem ${Q}cd "${SOURCE_DIR}"/tools/protogem && bundle install - ${Q}"${SOURCE_DIR}"/tools/protogem/build-proto-gem -o "${BUILD_DIR}/${BUILD_GEM_NAME}.gem" --name ${BUILD_GEM_NAME} --working-dir ${BUILD_DIR}/${BUILD_GEM_NAME}-gem ${BUILD_GEM_OPTIONS} + ${Q}GOGOPROTO_SOURCE_DIR="${GOGOPROTO_SOURCE_DIR}" RAFTPB_SOURCE_DIR="${RAFTPB_SOURCE_DIR}" "${SOURCE_DIR}"/tools/protogem/build-proto-gem -o "${BUILD_DIR}/${BUILD_GEM_NAME}.gem" --name ${BUILD_GEM_NAME} --working-dir ${BUILD_DIR}/${BUILD_GEM_NAME}-gem ${BUILD_GEM_OPTIONS} .PHONY: publish-proto-gem ## Build and publish the Ruby Gem that contains Gitaly's Protobuf definitions. diff --git a/tools/protogem/build-proto-gem b/tools/protogem/build-proto-gem index 9a56acf94c..547156d9a5 100755 --- a/tools/protogem/build-proto-gem +++ b/tools/protogem/build-proto-gem @@ -86,12 +86,23 @@ def generate_sources(output_dir, version) proto_output_dir = File.absolute_path(File.join(output_dir, 'ruby', 'proto', 'gitaly')) FileUtils.mkdir_p(proto_output_dir) + raftpb_sourcedir = ENV['RAFTPB_SOURCE_DIR'] + gogoproto_sourcedir = ENV['GOGOPROTO_SOURCE_DIR'] + + # gogoproto is a dependency of raftpb + gogoproto_dir = File.join(gogoproto_sourcedir, 'gogoproto') + gogoproto_files = Dir[File.join(gogoproto_dir, '*.proto')].sort + + raftpb_dir = File.join(raftpb_sourcedir, 'raftpb') + raftpb_files = Dir[File.join(raftpb_dir, '*.proto')].sort + + raft_proto_files = gogoproto_files + raftpb_files proto_dir = File.join(SOURCE_DIR, 'proto') proto_files = Dir[File.join(proto_dir, '*.proto')].sort run!( - %W[bundle exec grpc_tools_ruby_protoc -I #{proto_dir} --ruby_out=#{proto_output_dir} --grpc_out=#{proto_output_dir}] + proto_files, + %W[bundle exec grpc_tools_ruby_protoc -I #{proto_dir} -I #{gogoproto_sourcedir} -I #{raftpb_sourcedir} --ruby_out=#{proto_output_dir} --grpc_out=#{proto_output_dir}] + raft_proto_files + proto_files , File.join(SOURCE_DIR, 'tools', 'protogem') ) -- GitLab