Skip to content

Commit 12c897a

Browse files
committed
Add script to copy proto
1 parent 970c3af commit 12c897a

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

tools/buildgen/copy_protos.sh

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#! /bin/bash
2+
# Copyright 2025 gRPC authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
17+
set -e
18+
19+
GRPC_ROOT=$(realpath "$(dirname "$0")/../..")
20+
21+
# Source and destination directories (base paths).
22+
SRC_BASE="$GRPC_ROOT/src/proto/grpc"
23+
DST_BASE="$GRPC_ROOT/src/python"
24+
25+
copy_proto() {
26+
local proto_name="$1"
27+
local src_subdir="$2"
28+
local dst_subdir="$3"
29+
30+
local src_file="$SRC_BASE/$src_subdir/$proto_name.proto"
31+
local dst_file="$DST_BASE/$dst_subdir/$proto_name.proto"
32+
33+
cp "$src_file" "$dst_file"
34+
echo "Copied: $src_file -> $dst_file"
35+
}
36+
37+
# copy_proto proto_name src_subdir dst_subdir
38+
copy_proto "channelz" "channelz" "grpcio_channelz/grpc_channelz/v1"
39+
copy_proto "health" "health/v1" "grpcio_health_checking/grpc_health/v1"
40+
copy_proto "reflection" "reflection/v1alpha" "grpcio_reflection/grpc_reflection/v1alpha"
41+
42+
echo "Proto files copied successfully."

tools/buildgen/generate_projects.sh

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ generate_projects_virtual_environment/bin/python src/python/grpcio_observability
6262
TEST=true tools/buildgen/build_cleaner.py build_autogenerated.yaml
6363

6464
. tools/buildgen/generate_build_additions.sh
65+
. tools/buildgen/copy_protos.sh
6566

6667
# Instead of generating from a single build.yaml, we've split it into
6768
# - build_handwritten.yaml: manually written metadata

0 commit comments

Comments
 (0)