Skip to content

Commit fee9614

Browse files
wilhuffdavidair
authored andcommitted
Fix Firestore certificate loading in M41 (#2289)
* Stop bundling gRPC certificates with Firestore (#2279) * Remove references to roots.pem * Remove gRPCCertificates-Firestore.bundle * Fix size warning in local_serializer.cc * Suppress documentation warnings in gRPC * strip extra references to macOS
1 parent e23c40b commit fee9614

File tree

9 files changed

+46
-4419
lines changed

9 files changed

+46
-4419
lines changed

FirebaseFirestore.podspec

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
4848
]
4949
s.public_header_files = 'Firestore/Source/Public/*.h'
5050

51-
# TODO(varconst): remove once https://github.com/grpc/grpc/pull/16962 makes it
52-
# into a release.
53-
s.resource_bundles = { 'gRPCCertificates-Firestore' => ['Firestore/etc/roots.pem'] }
54-
5551
s.dependency 'FirebaseAuthInterop', '~> 1.0'
5652
s.dependency 'FirebaseCore', '~> 5.2'
5753
s.dependency 'gRPC-C++', '0.0.6'

Firestore/Example/Firestore.xcodeproj/project.pbxproj

Lines changed: 5 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,6 @@
12731273
54C9EDEE2040E16300A969CD /* Frameworks */,
12741274
54C9EDEF2040E16300A969CD /* Resources */,
12751275
EA424838F4A5DD7B337F57AB /* [CP] Embed Pods Frameworks */,
1276-
DE5C36328822481F6EB6EF16 /* [CP] Copy Pods Resources */,
12771276
);
12781277
buildRules = (
12791278
);
@@ -1314,7 +1313,6 @@
13141313
6003F587195388D20070C39A /* Frameworks */,
13151314
6003F588195388D20070C39A /* Resources */,
13161315
1EE692C7509A98D7EB03CA51 /* [CP] Embed Pods Frameworks */,
1317-
1E7DAED3207D01F1744EA227 /* [CP] Copy Pods Resources */,
13181316
);
13191317
buildRules = (
13201318
);
@@ -1515,32 +1513,14 @@
15151513
/* End PBXResourcesBuildPhase section */
15161514

15171515
/* Begin PBXShellScriptBuildPhase section */
1518-
1E7DAED3207D01F1744EA227 /* [CP] Copy Pods Resources */ = {
1519-
isa = PBXShellScriptBuildPhase;
1520-
buildActionMask = 2147483647;
1521-
files = (
1522-
);
1523-
inputPaths = (
1524-
"${SRCROOT}/Pods/Target Support Files/Pods-Firestore_Example_iOS/Pods-Firestore_Example_iOS-resources.sh",
1525-
"${PODS_CONFIGURATION_BUILD_DIR}/FirebaseFirestore/gRPCCertificates-Firestore.bundle",
1526-
);
1527-
name = "[CP] Copy Pods Resources";
1528-
outputPaths = (
1529-
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates-Firestore.bundle",
1530-
);
1531-
runOnlyForDeploymentPostprocessing = 0;
1532-
shellPath = /bin/sh;
1533-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Firestore_Example_iOS/Pods-Firestore_Example_iOS-resources.sh\"\n";
1534-
showEnvVarsInLog = 0;
1535-
};
15361516
1EE692C7509A98D7EB03CA51 /* [CP] Embed Pods Frameworks */ = {
15371517
isa = PBXShellScriptBuildPhase;
15381518
buildActionMask = 2147483647;
15391519
files = (
15401520
);
15411521
inputPaths = (
15421522
"${SRCROOT}/Pods/Target Support Files/Pods-Firestore_Example_iOS/Pods-Firestore_Example_iOS-frameworks.sh",
1543-
"${BUILT_PRODUCTS_DIR}/BoringSSL/openssl.framework",
1523+
"${BUILT_PRODUCTS_DIR}/BoringSSL-GRPC/openssl_grpc.framework",
15441524
"${BUILT_PRODUCTS_DIR}/GTMSessionFetcher/GTMSessionFetcher.framework",
15451525
"${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework",
15461526
"${BUILT_PRODUCTS_DIR}/Protobuf-iOS8.0/Protobuf.framework",
@@ -1551,7 +1531,7 @@
15511531
);
15521532
name = "[CP] Embed Pods Frameworks";
15531533
outputPaths = (
1554-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl.framework",
1534+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl_grpc.framework",
15551535
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMSessionFetcher.framework",
15561536
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework",
15571537
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework",
@@ -1774,32 +1754,14 @@
17741754
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
17751755
showEnvVarsInLog = 0;
17761756
};
1777-
DE5C36328822481F6EB6EF16 /* [CP] Copy Pods Resources */ = {
1778-
isa = PBXShellScriptBuildPhase;
1779-
buildActionMask = 2147483647;
1780-
files = (
1781-
);
1782-
inputPaths = (
1783-
"${SRCROOT}/Pods/Target Support Files/Pods-Firestore_Example_iOS-Firestore_SwiftTests_iOS/Pods-Firestore_Example_iOS-Firestore_SwiftTests_iOS-resources.sh",
1784-
"${PODS_CONFIGURATION_BUILD_DIR}/FirebaseFirestore/gRPCCertificates-Firestore.bundle",
1785-
);
1786-
name = "[CP] Copy Pods Resources";
1787-
outputPaths = (
1788-
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates-Firestore.bundle",
1789-
);
1790-
runOnlyForDeploymentPostprocessing = 0;
1791-
shellPath = /bin/sh;
1792-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Firestore_Example_iOS-Firestore_SwiftTests_iOS/Pods-Firestore_Example_iOS-Firestore_SwiftTests_iOS-resources.sh\"\n";
1793-
showEnvVarsInLog = 0;
1794-
};
17951757
EA424838F4A5DD7B337F57AB /* [CP] Embed Pods Frameworks */ = {
17961758
isa = PBXShellScriptBuildPhase;
17971759
buildActionMask = 2147483647;
17981760
files = (
17991761
);
18001762
inputPaths = (
18011763
"${SRCROOT}/Pods/Target Support Files/Pods-Firestore_Example_iOS-Firestore_SwiftTests_iOS/Pods-Firestore_Example_iOS-Firestore_SwiftTests_iOS-frameworks.sh",
1802-
"${BUILT_PRODUCTS_DIR}/BoringSSL/openssl.framework",
1764+
"${BUILT_PRODUCTS_DIR}/BoringSSL-GRPC/openssl_grpc.framework",
18031765
"${BUILT_PRODUCTS_DIR}/GTMSessionFetcher/GTMSessionFetcher.framework",
18041766
"${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework",
18051767
"${BUILT_PRODUCTS_DIR}/Protobuf-iOS8.0/Protobuf.framework",
@@ -1810,7 +1772,7 @@
18101772
);
18111773
name = "[CP] Embed Pods Frameworks";
18121774
outputPaths = (
1813-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl.framework",
1775+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl_grpc.framework",
18141776
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMSessionFetcher.framework",
18151777
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework",
18161778
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework",
@@ -1974,6 +1936,7 @@
19741936
549CCA5920A36E1F00BCEB75 /* precondition_test.cc in Sources */,
19751937
544129DC21C2DDC800EFB9CC /* query.pb.cc in Sources */,
19761938
6F3CAC76D918D6B0917EDF92 /* query_test.cc in Sources */,
1939+
132E3483789344640A52F223 /* reference_set_test.cc in Sources */,
19771940
B686F2B22025000D0028D6BE /* resource_path_test.cc in Sources */,
19781941
54740A571FC914BA00713A1A /* secure_random_test.cc in Sources */,
19791942
61F72C5620BC48FD001A68CB /* serializer_test.cc in Sources */,
@@ -2000,7 +1963,6 @@
20001963
C80B10E79CDD7EF7843C321E /* type_traits_apple_test.mm in Sources */,
20011964
ABC1D7DE2023A05300BA84F0 /* user_test.cc in Sources */,
20021965
544129DE21C2DDC800EFB9CC /* write.pb.cc in Sources */,
2003-
132E3483789344640A52F223 /* reference_set_test.cc in Sources */,
20041966
);
20051967
runOnlyForDeploymentPostprocessing = 0;
20061968
};

Firestore/core/src/firebase/firestore/local/local_serializer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ google_firestore_v1_Document LocalSerializer::EncodeDocument(
108108

109109
// Encode Document.fields (unless it's empty)
110110
size_t count = doc.data().object_value().internal_value.size();
111-
result.fields_count = count;
111+
result.fields_count = static_cast<pb_size_t>(count);
112112
result.fields = MakeArray<google_firestore_v1_Document_FieldsEntry>(count);
113113
int i = 0;
114114
for (const auto& kv : doc.data().object_value().internal_value) {

Firestore/core/src/firebase/firestore/remote/grpc_connection.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
#include "grpcpp/channel.h"
3636
#include "grpcpp/client_context.h"
3737
#include "grpcpp/completion_queue.h"
38+
#pragma clang diagnostic push
39+
#pragma clang diagnostic ignored "-Wdocumentation"
3840
#include "grpcpp/generic/generic_stub.h"
41+
#pragma clang diagnostic pop
3942

4043
namespace firebase {
4144
namespace firestore {

Firestore/core/src/firebase/firestore/remote/grpc_root_certificate_finder_apple.mm

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,40 +35,39 @@
3535
using util::StringFormat;
3636

3737
NSString* FindPathToCertificatesFile() {
38-
// Certificates file might be present in one of several bundles, based on
39-
// the environment.
40-
NSArray<NSBundle*>* bundles = @[
41-
// First, try to load certificates bundled by gRPC-C++ if available
42-
// (pod versions 0.0.6+).
43-
[NSBundle bundleWithIdentifier:@"org.cocoapods.grpcpp"],
44-
// Fall back to the certificates bundled with Firestore if necessary.
45-
[NSBundle bundleForClass:FSTFirestoreClient.class],
46-
// Finally, users manually adding resources to the project may add the
47-
// certificate to the main application bundle. Note that `mainBundle` is nil
48-
// for unit tests of library projects, so it cannot fully substitute for
49-
// checking framework bundles.
50-
[NSBundle mainBundle],
51-
];
38+
// Certificates file might be present in either the gRPC-C++ bundle or (for
39+
// some projects) in the main bundle.
40+
NSBundle* bundles[] = {
41+
// Try to load certificates bundled by gRPC-C++.
42+
[NSBundle bundleWithIdentifier:@"org.cocoapods.grpcpp"],
43+
// Users manually adding resources to the project may add the
44+
// certificate to the main application bundle. Note that `mainBundle` is
45+
// nil for unit tests of library projects, so it cannot fully substitute
46+
// for checking the framework bundle.
47+
[NSBundle mainBundle],
48+
};
5249

53-
for (NSBundle* bundle in bundles) {
50+
// search for the roots.pem file in each of these resource locations
51+
NSString* possibleResources[] = {
52+
@"gRPCCertificates.bundle/roots",
53+
@"roots",
54+
};
55+
56+
for (NSBundle* bundle : bundles) {
5457
if (!bundle) {
5558
continue;
5659
}
5760

58-
NSString* resource = @"gRPCCertificates.bundle/roots";
59-
NSString* path = [bundle pathForResource:resource ofType:@"pem"];
60-
if (!path) {
61-
resource = @"gRPCCertificates-Firestore.bundle/roots";
62-
path = [bundle pathForResource:resource ofType:@"pem"];
63-
}
64-
65-
if (path) {
66-
LOG_DEBUG("%s.pem found in bundle %s", resource,
67-
[bundle bundleIdentifier]);
68-
return path;
69-
} else {
70-
LOG_DEBUG("%s.pem not found in bundle %s", resource,
71-
[bundle bundleIdentifier]);
61+
for (NSString* resource : possibleResources) {
62+
NSString* path = [bundle pathForResource:resource ofType:@"pem"];
63+
if (path) {
64+
LOG_DEBUG("%s.pem found in bundle %s", resource,
65+
[bundle bundleIdentifier]);
66+
return path;
67+
} else {
68+
LOG_DEBUG("%s.pem not found in bundle %s", resource,
69+
[bundle bundleIdentifier]);
70+
}
7271
}
7372
}
7473

Firestore/core/src/firebase/firestore/remote/grpc_stream.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232
#include "Firestore/core/src/firebase/firestore/util/status.h"
3333
#include "absl/types/optional.h"
3434
#include "grpcpp/client_context.h"
35+
#pragma clang diagnostic push
36+
#pragma clang diagnostic ignored "-Wdocumentation"
3537
#include "grpcpp/generic/generic_stub.h"
38+
#pragma clang diagnostic pop
3639
#include "grpcpp/support/byte_buffer.h"
3740

3841
namespace firebase {

Firestore/core/src/firebase/firestore/remote/grpc_streaming_reader.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
#include "Firestore/core/src/firebase/firestore/util/status.h"
2828
#include "Firestore/core/src/firebase/firestore/util/statusor.h"
2929
#include "grpcpp/client_context.h"
30+
#pragma clang diagnostic push
31+
#pragma clang diagnostic ignored "-Wdocumentation"
3032
#include "grpcpp/generic/generic_stub.h"
33+
#pragma clang diagnostic pop
3134
#include "grpcpp/support/byte_buffer.h"
3235

3336
namespace firebase {

Firestore/core/src/firebase/firestore/remote/grpc_unary_call.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
#include "Firestore/core/src/firebase/firestore/util/status.h"
2828
#include "Firestore/core/src/firebase/firestore/util/statusor.h"
2929
#include "grpcpp/client_context.h"
30+
#pragma clang diagnostic push
31+
#pragma clang diagnostic ignored "-Wdocumentation"
3032
#include "grpcpp/generic/generic_stub.h"
33+
#pragma clang diagnostic pop
3134
#include "grpcpp/support/byte_buffer.h"
3235

3336
namespace firebase {

0 commit comments

Comments
 (0)