Bladeren bron

Additional support for C++ sources in Firestore (#462)

* Fix up style from previous PRs
* Clang-format configuration for C++ files
* Add support C++-only sources to the podspec
Gil 8 jaren geleden
bovenliggende
commit
5fbad1b2e2

+ 8 - 4
Firestore/Example/Tests/SpecTests/FSTMockDatastore.h

@@ -22,12 +22,16 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface FSTMockDatastore : FSTDatastore
 
-/** A count of the total number of requests sent to the watch stream since the beginning of the test
- * case. */
+/**
+ * A count of the total number of requests sent to the watch stream since the beginning of the test
+ * case.
+ */
 @property(nonatomic) int watchStreamRequestCount;
 
-/** A count of the total number of requests sent to the write stream since the beginning of the test
- * case. */
+/**
+ * A count of the total number of requests sent to the write stream since the beginning of the test
+ * case.
+ */
 @property(nonatomic) int writeStreamRequestCount;
 
 + (instancetype)mockDatastoreWithWorkerDispatchQueue:(FSTDispatchQueue *)workerDispatchQueue;

+ 18 - 5
Firestore/Firestore.podspec

@@ -24,10 +24,23 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
 
   s.ios.deployment_target = '8.0'
 
-  s.source_files = 'Source/**/*', 'Port/**/*', 'Protos/objc/**/*.[hm]', 'third_party/**/*.[mh]'
-  s.requires_arc = 'Source/**/*', 'third_party/**/*.[mh]'
-  s.exclude_files = 'Port/*test.cc', 'third_party/**/Tests/**'
+  s.source_files = [
+    'Source/**/*',
+    'Port/**/*',
+    'Protos/objc/**/*.[hm]',
+    'src/core/**/*.{h,cc}',
+    'third_party/**/*.[mh]'
+  ]
+  s.requires_arc = [
+    'Source/**/*',
+    'third_party/**/*.[mh]'
+  ]
+  s.exclude_files = [
+    'Port/*test.cc',
+    'third_party/**/Tests/**'
+  ]
   s.public_header_files = 'Source/Public/*.h'
+
   s.frameworks = 'MobileCoreServices'
   s.dependency 'gRPC-ProtoRPC'
   s.dependency 'leveldb-library'
@@ -36,8 +49,8 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
   s.dependency 'FirebaseCommunity/Auth'
   s.library = 'c++'
 
-  s.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' =>
-    'GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1 ',
+  s.pod_target_xcconfig = {
+    'GCC_PREPROCESSOR_DEFINITIONS' => 'GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1 ',
     'OTHER_CFLAGS' => '-DFIRFirestore_VERSION=' + s.version.to_s
   }
 end

+ 8 - 0
Firestore/src/.clang-format

@@ -0,0 +1,8 @@
+BasedOnStyle: Google
+Standard: Cpp11
+ColumnLimit: 80
+BinPackParameters: false
+AllowAllParametersOfDeclarationOnNextLine: true
+SpacesInContainerLiterals: true
+PointerAlignment: Left
+AllowShortFunctionsOnASingleLine: None

+ 2 - 1
scripts/style.sh

@@ -19,7 +19,8 @@ find . \
     -name 'FirebaseCommunity.h' -prune -o \
     -name 'Messaging' -prune -o \
     -name 'Pods' -prune -o \
-    \( -name '*.[mh]' -o -name '*.mm' \) \
+    -path '*/Firestore/Port/*' -prune -o \
+    \( -name '*.[mh]' -o -name '*.mm' -o -name '*.cc' \) \
     -not -name '*.pbobjc.*' \
     -not -name '*.pbrpc.*' \
     -print0 | xargs -0 clang-format -style=file -i