Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gRPC: Add channelz, reflection #1333

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,9 @@
"grpc",
"grpc_unsecure",
"grpc++",
"grpc++_unsecure"
"grpc++_unsecure",
"grpc++_channelz",
"grpc++_reflection"
],
"program_names": [
"grpc_cpp_plugin",
Expand All @@ -1019,6 +1021,7 @@
"grpc_ruby_plugin"
],
"versions": [
"1.59.1-2",
"1.59.1-1"
]
},
Expand Down
2 changes: 2 additions & 0 deletions subprojects/grpc.wrap
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ grpc = grpc_dep
grpc_unsecure = grpc_unsecure_dep
grpc++ = grpcpp_dep
grpc++_unsecure = grpcpp_unsecure_dep
grpc++_channelz = grpcpp_channelz_dep
grpc++_reflection = grpcpp_reflection_dep
program_names = grpc_cpp_plugin, grpc_python_plugin, grpc_ruby_plugin, grpc_php_plugin, grpc_node_plugin
48 changes: 48 additions & 0 deletions subprojects/packagefiles/grpc/compile-proto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env python3

import argparse
import sys
from pathlib import Path
import subprocess
import os


def builddir_suffix(proto: Path, source_root: Path) -> str:
return os.path.relpath(proto.resolve().parent, source_root.resolve())

def symlink(target: Path, alias: Path) -> str:
rtarget = Path(os.path.relpath(target.resolve(), alias.resolve().parent))
if alias.is_symlink():
alias.unlink()
alias.symlink_to(rtarget)

def compileSources(files: [Path], protoc: Path, grpc_plugin: Path, srcdir: Path, builddir: Path):
for p in files:
outdir = builddir / builddir_suffix(p, srcdir)
outdir.mkdir(parents=True, exist_ok=True)
cmd = [
f"{protoc}",
f"--plugin=protoc-gen-grpc={grpc_plugin.resolve()}",
f"--cpp_out={outdir}",
f"--grpc_out={outdir}",
"--proto_path=" + str(p.parent),
str(p),
]
ecode = subprocess.Popen(cmd).wait()
assert(ecode == 0)

basename = p.name.replace(".proto", "")
for ext in {".pb.h", ".pb.cc", ".grpc.pb.h", ".grpc.pb.cc"}:
newname = basename + ext
symlink(outdir / newname, builddir / newname)

if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--protoc", help="path to protoc compiler executable")
parser.add_argument("-p", "--grpc_plugin", help="path to grpc_cpp_plugin executable")
parser.add_argument("-s", "--src-dir", help="source root directory")
parser.add_argument("-o", "--out-dir", help="output directory")
parser.add_argument("proto_file", nargs="+", help="input .proto files")
args = parser.parse_args()
compileSources(list(map(Path, args.proto_file)), Path(args.protoc), Path(args.grpc_plugin), Path(args.src_dir), Path(args.out_dir))

Loading
Loading