From 11d28d80ff0adb471c440a8f7d6c362d6f303006 Mon Sep 17 00:00:00 2001 From: Rich Gowman Date: Wed, 31 Jan 2018 14:12:07 -0500 Subject: Add instructions for building nanopb protos Currently only supported on osx --- Firestore/Protos/README.md | 10 ++++++++++ Firestore/Protos/build-protos.sh | 12 +++++++++++- Firestore/Protos/protos/google/api/http.options | 1 + .../Protos/protos/google/firestore/v1beta1/document.options | 1 + .../Protos/protos/google/firestore/v1beta1/firestore.options | 6 ++++++ .../Protos/protos/google/firestore/v1beta1/write.options | 1 + Firestore/Protos/protos/google/protobuf/struct.options | 1 + 7 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 Firestore/Protos/protos/google/api/http.options create mode 100644 Firestore/Protos/protos/google/firestore/v1beta1/document.options create mode 100644 Firestore/Protos/protos/google/firestore/v1beta1/firestore.options create mode 100644 Firestore/Protos/protos/google/firestore/v1beta1/write.options create mode 100644 Firestore/Protos/protos/google/protobuf/struct.options (limited to 'Firestore/Protos') diff --git a/Firestore/Protos/README.md b/Firestore/Protos/README.md index cb6d90e..6137ff6 100644 --- a/Firestore/Protos/README.md +++ b/Firestore/Protos/README.md @@ -1,5 +1,15 @@ ## Usage +First, build protobuf and nanopb +``` +cd firebase-ios-sdk +mkdir -p build +cd build +cmake .. +make -j protobuf nanopb +``` + +Next, build the protos: ``` cd firebase-ios-sdk/Firestore/Protos ./build-protos.sh diff --git a/Firestore/Protos/build-protos.sh b/Firestore/Protos/build-protos.sh index 4cfb12e..5c3aa53 100755 --- a/Firestore/Protos/build-protos.sh +++ b/Firestore/Protos/build-protos.sh @@ -20,7 +20,17 @@ rm Podfile.lock pod update # Generate the objective C files from the protos. -./Pods/!ProtoCompiler/protoc --plugin=protoc-gen-grpc=Pods/\!ProtoCompiler-gRPCPlugin/grpc_objective_c_plugin -I protos --objc_out=objc --grpc_out=objc `find protos -name *.proto -print | xargs` +./Pods/!ProtoCompiler/protoc \ + --plugin=protoc-gen-grpc=Pods/\!ProtoCompiler-gRPCPlugin/grpc_objective_c_plugin \ + --plugin=../../build/external/nanopb/src/nanopb-build/generator/protoc-gen-nanopb \ + -I protos --objc_out=objc --grpc_out=objc \ + --nanopb_out="--options-file=protos/%s.options:nanopb" \ + `find protos -name *.proto -print | xargs` + +# If a proto uses a field named 'delete', nanopb happily uses that in the +# message definition. Works fine for C; not so much for C++. Rename uses of this +# to delete_ (which is how protoc does it for c++ files.) +perl -i -pe 's/\bdelete\b/delete_/g' `find nanopb -type f` # CocoaPods does not like paths in library imports, flatten them. diff --git a/Firestore/Protos/protos/google/api/http.options b/Firestore/Protos/protos/google/api/http.options new file mode 100644 index 0000000..6ddde53 --- /dev/null +++ b/Firestore/Protos/protos/google/api/http.options @@ -0,0 +1 @@ +google.api.HttpRule.pattern no_unions:true diff --git a/Firestore/Protos/protos/google/firestore/v1beta1/document.options b/Firestore/Protos/protos/google/firestore/v1beta1/document.options new file mode 100644 index 0000000..e671c43 --- /dev/null +++ b/Firestore/Protos/protos/google/firestore/v1beta1/document.options @@ -0,0 +1 @@ +google.firestore.v1beta1.Value.value_type no_unions:true diff --git a/Firestore/Protos/protos/google/firestore/v1beta1/firestore.options b/Firestore/Protos/protos/google/firestore/v1beta1/firestore.options new file mode 100644 index 0000000..71a05d4 --- /dev/null +++ b/Firestore/Protos/protos/google/firestore/v1beta1/firestore.options @@ -0,0 +1,6 @@ +google.firestore.v1beta1.GetDocumentRequest.consistency_selector no_unions:true +google.firestore.v1beta1.ListDocumentsRequest.consistency_selector no_unions:true +google.firestore.v1beta1.RunQueryRequest.consistency_selector no_unions:true +google.firestore.v1beta1.BatchGetDocumentsRequest.consistency_selector no_unions:true +google.firestore.v1beta1.BatchGetDocumentsResponse.result no_unions:true +google.firestore.v1beta1.Target.resume_type no_unions:true diff --git a/Firestore/Protos/protos/google/firestore/v1beta1/write.options b/Firestore/Protos/protos/google/firestore/v1beta1/write.options new file mode 100644 index 0000000..41c6a34 --- /dev/null +++ b/Firestore/Protos/protos/google/firestore/v1beta1/write.options @@ -0,0 +1 @@ +google.firestore.v1beta1.Write.operation no_unions:true diff --git a/Firestore/Protos/protos/google/protobuf/struct.options b/Firestore/Protos/protos/google/protobuf/struct.options new file mode 100644 index 0000000..56fa2d0 --- /dev/null +++ b/Firestore/Protos/protos/google/protobuf/struct.options @@ -0,0 +1 @@ +google.protobuf.Value.kind no_unions:true -- cgit v1.2.3