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

Generate C++ Bindings #48

Draft
wants to merge 2 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
67 changes: 66 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PROTOC_GEN_TS_PATH=${HOME}/npm_modules/bin/protoc-gen-ts
PROTOC_CPP_PLUGIN=$(shell which grpc_cpp_plugin)

.PHONY: proto
proto: proto-gen tidy
Expand Down Expand Up @@ -98,6 +99,14 @@ gen-file:
--plugin=protoc-gen-grpc-java=build/protoc-gen-grpc-java \
--grpc-java_out=java \
pb/file.proto
# generate cpp bindings
protoc \
-I=pb \
-I=${GOPATH}/src \
--plugin=protoc-gen-grpc=${PROTOC_CPP_PLUGIN} \
--cpp_out=cpp \
--grpc_out=cpp \
pb/file.proto

gen-util:
# generate golang bindings (util)
Expand Down Expand Up @@ -134,6 +143,14 @@ gen-util:
--plugin=protoc-gen-grpc-java=build/protoc-gen-grpc-java \
--grpc-java_out=java \
pb/util.proto
# generate cpp bindings (file)
protoc \
-I=pb \
-I=${GOPATH}/src \
--plugin=protoc-gen-grpc=${PROTOC_CPP_PLUGIN} \
--cpp_out=cpp \
--grpc_out=cpp \
pb/util.proto

gen-node:
# generate golang bindings (node)
Expand Down Expand Up @@ -171,6 +188,14 @@ gen-node:
--plugin=protoc-gen-grpc-java=build/protoc-gen-grpc-java \
--grpc-java_out=java \
pb/node.proto
# generate cpp bindings (node)
protoc \
-I=pb \
-I=${GOPATH}/src \
--plugin=protoc-gen-grpc=${PROTOC_CPP_PLUGIN} \
--cpp_out=cpp \
--grpc_out=cpp \
pb/node.proto

gen-status:
# generate golang bindings (status)
Expand Down Expand Up @@ -208,6 +233,14 @@ gen-status:
--plugin=protoc-gen-grpc-java=build/protoc-gen-grpc-java \
--grpc-java_out=java \
pb/status.proto
# generate cpp bindings (status)
protoc \
-I=pb \
-I=${GOPATH}/src \
--plugin=protoc-gen-grpc=${PROTOC_CPP_PLUGIN} \
--cpp_out=cpp \
--grpc_out=cpp \
pb/status.proto

gen-pubsub:
# generate golang bindings (pubsub)
Expand Down Expand Up @@ -245,6 +278,14 @@ gen-pubsub:
--plugin=protoc-gen-grpc-java=build/protoc-gen-grpc-java \
--grpc-java_out=java \
pb/pubsub.proto
# generate cpp bindings (pubsub)
protoc \
-I=pb \
-I=${GOPATH}/src \
--plugin=protoc-gen-grpc=${PROTOC_CPP_PLUGIN} \
--cpp_out=cpp \
--grpc_out=cpp \
pb/pubsub.proto

gen-admin:
# generate golang bindings (admin)
Expand Down Expand Up @@ -282,6 +323,14 @@ gen-admin:
--plugin=protoc-gen-grpc-java=build/protoc-gen-grpc-java \
--grpc-java_out=java \
pb/admin.proto
# generate cpp bindings (admin)
protoc \
-I=pb \
-I=${GOPATH}/src \
--plugin=protoc-gen-grpc=${PROTOC_CPP_PLUGIN} \
--cpp_out=cpp \
--grpc_out=cpp \
pb/admin.proto

gen-namesys:
# generate golang bindings (namesys)
Expand Down Expand Up @@ -318,6 +367,14 @@ gen-namesys:
--plugin=protoc-gen-grpc-java=build/protoc-gen-grpc-java \
--grpc-java_out=java \
pb/namesys.proto
# generate cpp bindings (namesys)
protoc \
-I=pb \
-I=${GOPATH}/src \
--plugin=protoc-gen-grpc=${PROTOC_CPP_PLUGIN} \
--cpp_out=cpp \
--grpc_out=cpp \
pb/namesys.proto

gen-replication:
# generate golang bindings (replication)
Expand Down Expand Up @@ -355,7 +412,15 @@ gen-replication:
--plugin=protoc-gen-grpc-java=build/protoc-gen-grpc-java \
--grpc-java_out=java \
pb/replication.proto

# generate cpp bindings (replication)
protoc \
-I=pb \
-I=${GOPATH}/src \
--plugin=protoc-gen-grpc=${PROTOC_CPP_PLUGIN} \
--cpp_out=cpp \
--grpc_out=cpp \
pb/replication.proto

gen-docs:
# generate documentation
protoc \
Expand Down
38 changes: 21 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# TxPB

`TxPB` is the main source of information for using TemporalX, and includes protocol buffer definitions, generated code, and documentation. If you are looking for the protocol buffer definitions, check the `pb` folder.
TxPB is the main public information repository for TemporalX. It includes all protocol buffers we use, along with their generated gRPC code in a variety of languages. Additionally there is documentation on some of the TemporalX subsystems, such as the reference counter, and licensing system. Additinoally the configuration file is fully documented, along with a small "getting started" tutorial.

We have pre-generated gRPC bindings for the following languages:
Pre-generated gRPC and protocol buffer bindings exist for the following languages:

* [golang](https://github.com/RTradeLtd/TxPB/tree/master/go)
* [javascript (grpc-web)](https://github.com/RTradeLtd/TxPB/tree/master/js)
* [typescript (grpc-web)](https://github.com/RTradeLtd/TxPB/tree/master/ts)
* [java](https://github.com/RTradeLtd/TxPB/tree/master/java/pb)
* [python](https://github.com/RTradeLtd/TxPB/tree/master/py)

If you want bindings in other languages, feel free to open a github issue. Alternatively you can generate language bindings independently as long as the languages you are using support the appropriate protocol buffer and gRPC versions.
* [C++](https://github.com/RTradeLtd/TxPB/tree/master/cpp)
* [Golang](https://github.com/RTradeLtd/TxPB/tree/master/go)
* [Java](https://github.com/RTradeLtd/TxPB/tree/master/java)
* [JavaScript (grpc-web)](https://github.com/RTradeLtd/TxPB/tree/master/js)
* [Python](https://github.com/RTradeLtd/TxPB/tree/master/py)
* [TypeScript (grpc-web)](https://github.com/RTradeLtd/TxPB/tree/master/ts)

# Documentation

Expand All @@ -26,17 +25,22 @@ If you want bindings in other languages, feel free to open a github issue. Alter

# Code Generation

Before generating the code, you'll need to download quite a few generators. Before downloading the generators you'll need to have a valid installation of the following, please consult appropriate installation manuals as required:
Code generation requires a number of dependencies installed, particularily an environment capable of building gRPC code for the following languages:

* C++
* Golang
* Java
* JavaScript
* Python
* TypeScript

To generate the code for all aforementioned languages, simply type `make`. Along with generating code, this will update the generated markdown documentation.

* Go 1.13+
* NodeJS
* NPM
* Python3
* Make
## Installing Generators (TODO)

Once you have all of this installed, you can then install the needed generators which will allow you to generate the gRPC client stubs. To do this run `make install`. This has to download quite a few packages so it might take some time to complete. The only thing this doesn't install is a java generator, to do that visit https://search.maven.org/search?q=g:io.grpc%20a:protoc-gen-grpc-java and download the one for your platform.
### Java

After you've downloaded all generator tooling, you can generate the client stubs, and documentation with a single `make`.
To install the java generator, vist [search.maven.org](https://search.maven.org/search?q=g:io.grpc%20a:protoc-gen-grpc-java)

# License

Expand Down
128 changes: 128 additions & 0 deletions cpp/admin.grpc.pb.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading