Meyer Auslander
Meyer Auslander

Reputation: 349

running the grpc php plugin on DA Ledger API proto files

I am building the client-side of my ledger application in PHP. I have written the DAML code, gone through the grpc quickstart tutorial, and I ran the command

da add ledger-api-protos

and now it seems the next step is to run the grpc_php_plugin to covert the .proto files into php classes and functions. In the quickstart tutorial the command is as follows:

protoc --proto_path=examples/protos \
  --php_out=examples/php \
  --grpc_out=examples/php \
  --plugin=protoc-gen-grpc=bins/opt/grpc_php_plugin \
  ./examples/protos/helloworld.proto

There is only one .proto file. However, my project folder has an entire directory structure of .proto files! How should the 'protoc' command look for the my project?

I see there are three different main directories: com, google, grpc. Do I need to include the the .proto files from all three? I see that many of the .proto files are interdependent. Are there one or two main .proto files that are needed and will cause all of the others to be pulled in as a result?

Upvotes: 1

Views: 141

Answers (1)

Zhouyihai Ding
Zhouyihai Ding

Reputation: 363

protoc --proto_path=proto_dir \
  --php_out=xxxxx \
  --grpc_out=xxxxx \
  --plugin=protoc-gen-grpc=bins/opt/grpc_php_plugin \
  a.proto b.proto c.proto ...

Or refer to how this script does it: https://github.com/googleapis/googleapis/blob/master/Makefile#L39

Upvotes: 2

Related Questions