aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Protos
diff options
context:
space:
mode:
authorGravatar Rich Gowman <rgowman@google.com>2018-01-31 14:12:07 -0500
committerGravatar Rich Gowman <rgowman@google.com>2018-02-06 10:02:30 -0500
commit11d28d80ff0adb471c440a8f7d6c362d6f303006 (patch)
tree861aab23e0f87dc52710e16de39f7b74404b6ad0 /Firestore/Protos
parentace2ed15fe078008986226ef31c122dd6c21745d (diff)
Add instructions for building nanopb protos
Currently only supported on osx
Diffstat (limited to 'Firestore/Protos')
-rw-r--r--Firestore/Protos/README.md10
-rwxr-xr-xFirestore/Protos/build-protos.sh12
-rw-r--r--Firestore/Protos/protos/google/api/http.options1
-rw-r--r--Firestore/Protos/protos/google/firestore/v1beta1/document.options1
-rw-r--r--Firestore/Protos/protos/google/firestore/v1beta1/firestore.options6
-rw-r--r--Firestore/Protos/protos/google/firestore/v1beta1/write.options1
-rw-r--r--Firestore/Protos/protos/google/protobuf/struct.options1
7 files changed, 31 insertions, 1 deletions
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