Skip to content

Commit

Permalink
Firestore podspec: avoid adding Firestore headers to sources (#4054)
Browse files Browse the repository at this point in the history
See #4035: a certain combination of pods can lead to a broken build. The underlying issue is that CocoaPods generate a header map that includes headers from _all_ the pods in a project. A header map maps short file names to full paths and is unable to handle collisions; thus, in a CocoaPods-based build, if one pod contains a header with a common name, and the other pod tries to import a header with the same short name by relying on header maps (without specifying a longer path), the header from one pod may end up getting erroneously picked up by the other pod.

In that particular case, `SVGKit` is relying on header maps and trying to import `Document.h`, which, for reasons described above, happens to pick up `document.h` from Firestore. However, since header maps cannot handle collisions in general, this could manifest with other pods as well.

The workaround is to avoid adding Firestore header files (except the public ones) to sources.

See facebook/react-native#14326, which describes the same problem.

Fixes #4035.
  • Loading branch information
var-const authored Oct 14, 2019
1 parent c2bc304 commit a59abed
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions FirebaseFirestore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,23 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
s.prefix_header_file = false

s.source_files = [
'Firestore/Source/**/*.{h,m,mm}',
'Firestore/Protos/nanopb/**/*.{h,cc}',
'Firestore/Protos/objc/**/*.[hm]',
'Firestore/core/include/**/*.{h,cc,mm}',
'Firestore/core/src/**/*.{h,cc,mm}',
'Firestore/Source/Public/*.h',
'Firestore/Source/**/*.{m,mm}',
'Firestore/Protos/nanopb/**/*.cc',
'Firestore/Protos/objc/**/*.m',
'Firestore/core/include/**/*.{cc,mm}',
'Firestore/core/src/**/*.{cc,mm}',
]
s.preserve_paths = [
'Firestore/Source/API/*.h',
'Firestore/Source/Core/*.h',
'Firestore/Source/Local/*.h',
'Firestore/Source/Remote/*.h',
'Firestore/Source/Util/*.h',
'Firestore/Protos/nanopb/**/*.h',
'Firestore/Protos/objc/**/*.h',
'Firestore/core/include/**/*.h',
'Firestore/core/src/**/*.h',
]
s.requires_arc = [
'Firestore/Source/**/*',
Expand Down Expand Up @@ -74,7 +86,11 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
'"${PODS_TARGET_SRCROOT}/Firestore/Source/Public" ' +
'"${PODS_TARGET_SRCROOT}/Firestore/third_party/abseil-cpp" ' +
'"${PODS_ROOT}/nanopb" ' +
'"${PODS_TARGET_SRCROOT}/Firestore/Protos/nanopb"',
'"${PODS_TARGET_SRCROOT}/Firestore/Protos/nanopb" ' +
'"${PODS_TARGET_SRCROOT}/Firestore/Protos/objc/google/api" ' +
'"${PODS_TARGET_SRCROOT}/Firestore/Protos/objc/google/firestore/v1" ' +
'"${PODS_TARGET_SRCROOT}/Firestore/Protos/objc/google/rpc" ' +
'"${PODS_TARGET_SRCROOT}/Firestore/Protos/objc/google/type"',
}

# Generate a version of the config.h header suitable for building with
Expand Down

0 comments on commit a59abed

Please sign in to comment.