Skip to content

Commit

Permalink
chore: remove FirebaseFirestoreSwift framework if RNFB or FF project
Browse files Browse the repository at this point in the history
  • Loading branch information
russellwheatley committed Oct 26, 2022
1 parent 0e2b517 commit 7b936d5
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions FirebaseFirestore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,27 @@ Pod::Spec.new do |s|

s.default_subspecs = "AutodetectLeveldb"

# Skip leveldb framework if Firebase Database is included in any form
# Skip FirebaseFirestoreSwift if project is FlutterFire or React Native Firebase project. See:
# https://github.com/invertase/firestore-ios-sdk-frameworks/issues/62
current_target_definition = Pod::Config.instance.podfile.send(:current_target_definition)
current_definition_string = current_target_definition.to_hash.to_s

hasCloudFirestore = current_definition_string.include?('cloud_firestore')
hasRNFBFirestore = current_definition_string.include?('RNFBFirestore')

# Base Pod gets everything except leveldb, which if included here may collide with inclusions elsewhere
s.subspec 'Base' do |base|
frameworksBase = Dir.glob("FirebaseFirestore/*.xcframework").select do |name|
! name.include?('leveldb') && ! name.include?('FirebaseFirestoreSwift')
if name.include?('leveldb')
false
elsif hasCloudFirestore && name.include?('FirebaseFirestoreSwift')
false
elsif hasRNFBFirestore && name.include?('FirebaseFirestoreSwift')
false
else
true
end
end

base.vendored_frameworks = frameworksBase
Expand All @@ -41,9 +58,6 @@ Pod::Spec.new do |s|
s.subspec 'AutodetectLeveldb' do |autodb|
autodb.dependency 'FirebaseFirestore/Base'

# Skip leveldb framework if Firebase Database is included in any form
current_target_definition = Pod::Config.instance.podfile.send(:current_target_definition)
current_definition_string = current_target_definition.to_hash.to_s

skip_leveldb = false

Expand Down

0 comments on commit 7b936d5

Please sign in to comment.