invertase / firestore-ios-sdk-frameworks

⚡ Precompiled Firestore iOS SDKs extracted from the Firebase iOS SDK repository release downloads for faster build times.
Apache License 2.0
427 stars 48 forks source link

fix: Removed `FirebaseFirestoreSwift` from umbrella framework for FlutterFire & React Native Firebase projects #63

Closed russellwheatley closed 1 year ago

russellwheatley commented 1 year ago

closes https://github.com/invertase/firestore-ios-sdk-frameworks/issues/62

russellwheatley commented 1 year ago

Let me know if this works for RNFB, @mikehardy (I thought this was an issue on RNFB but can't seem to find it now. I can remove the if condition for RNFB although I would think it's not needed anyway and it is being built for nothing). It works for FlutterFire.

Use:

pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :branch => "@russell/ios-10"

in your Podfile if you want to test 😄

leehack commented 1 year ago

@russellwheatley It stuck in this with pod install for me. Any clues?

Pre-downloading: `FirebaseFirestore` from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, branch `@russell/ios-10`
mikehardy commented 1 year ago

I will test later this morning, rnfb does use this sometimes it is just not logged as I'm tracking personally and using the FF issue as a proxy

To make sure I understand, zip and pod may interoperate with this shared swift pod in between, but only if it comes in via cocoapods, not as a zip component? Same as leveldb it seems and will inform how to handle any future shared stuff if it's in a new component

russellwheatley commented 1 year ago

@leehack show me your Podfile, please?

leehack commented 1 year ago
# Override Firebase SDK Version
$FirebaseSDKVersion = '10.0.0'
# Uncomment this line to define a global platform for your project
platform :ios, '13'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :branch => "@russell/ios-10" 
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      # Using the un-qualified names means you can swap in different implementations, for example ccache
      # https://reactnative.dev/docs/0.69/build-speed#xcode-specific-setup
      config.build_settings["CC"] = "clang"
      config.build_settings["LD"] = "clang"
      config.build_settings["CXX"] = "clang++"
      config.build_settings["LDPLUSPLUS"] = "clang++"
      # config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
    end
    flutter_additional_ios_build_settings(target)
  end
end
russellwheatley commented 1 year ago

To make sure I understand, zip and pod may interoperate with this shared swift pod in between, but only if it comes in via cocoapods, not as a zip component? Same as leveldb it seems and will inform how to handle any future shared stuff if it's in a new component.

FirebaseFirestoreSwift has a dependency on FirebaseSharedSwift. We don't need FirebaseFirestoreSwift with our FF project because it is an obj-c project. We only need FirebaseFirestore framework.

I don't believe a zipped + compiled dependency like FirebaseFirestoreSwift which has a dependency on FirebaseFirestoreSwift will work if there is another dependency which has a sub-dependency for FirebaseSharedSwift coming from Cocoapods. I don't think they are interoperable to answer your question.

russellwheatley commented 1 year ago

@leehack hmmm, not sure based on your Podfile. Have you fully cleaned your project?

russellwheatley commented 1 year ago

@leehack might be worth building in xcode as well, you will likely get better logging to debug.

leehack commented 1 year ago

@russellwheatley Sure. Let me try it. Just for your info, it doesn't stick with 10.0.0.

leehack commented 1 year ago

@russellwheatley wait. I can't build from xcode anyway without pod install no?

russellwheatley commented 1 year ago

@leehack woops, yeah, that is correct. Not sure what this means:

Just for your info, it doesn't stick with 10.0.0.

russellwheatley commented 1 year ago

Send me your pubspec as well. I'll see if I can build

leehack commented 1 year ago

@russellwheatley I meant the pre-download part works with:

pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => "10.0.0"
leehack commented 1 year ago
➜  ios git:(main) ✗ pod install --verbose
  Preparing

Analyzing dependencies

Inspecting targets to integrate
  Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

Fetching external sources
-> Pre-downloading: `FirebaseFirestore` from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, branch `@russell/ios-10`
  $ /usr/bin/git ls-remote -- https://github.com/invertase/firestore-ios-sdk-frameworks.git @russell/ios-10
  7b936d57d4ae0c04d05c2096892927dc326a2c0c  refs/heads/@russell/ios-10
 > Git download
 > Git download
     $ /usr/bin/git clone https://github.com/invertase/firestore-ios-sdk-frameworks.git
     /var/folders/b8/__12f73541qdmx847t78zk680000gp/T/d20221026-37065-kam5m5 --template=
     Cloning into '/var/folders/b8/__12f73541qdmx847t78zk680000gp/T/d20221026-37065-kam5m5'...
leehack commented 1 year ago

Send me your podspec as well. I'll see if I can build

Let me prepare a clean project for this.

leehack commented 1 year ago

@russellwheatley

name: test_ff
description: A new Flutter project.

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment:
  sdk: '>=2.18.2 <3.0.0'

dependencies:
  flutter:
    sdk: flutter
  firebase_core: ^2.0.0
  cloud_firestore: ^4.0.1
  cloud_functions: ^4.0.1

  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.0

flutter:
  uses-material-design: true

Not sure why but no matter the dependency I have, It just can't download the precompiled SDK from the branch.

leehack commented 1 year ago

@russellwheatley

-> Pre-downloading: `FirebaseFirestore` from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, tag `10.0.0`
 > Git download
 > Git download
     $ /usr/bin/git clone https://github.com/invertase/firestore-ios-sdk-frameworks.git
     /var/folders/b8/__12f73541qdmx847t78zk680000gp/T/d20221026-41430-4rscaw --template= --single-branch --depth 1 --branch 10.0.0
     Cloning into '/var/folders/b8/__12f73541qdmx847t78zk680000gp/T/d20221026-41430-4rscaw'...
     Note: switching to '74360c9d2a3197257646c78cb4a6c277e9263d66'.

     You are in 'detached HEAD' state. You can look around, make experimental
     changes and commit them, and you can discard any commits you make in this
     state without impacting any branches by switching back to a branch.

     If you want to create a new branch to retain commits you create, you may
     do so (now or later) by using -c with the switch command. Example:

       git switch -c <new-branch-name>

     Or undo this operation with:

       git switch -

     Turn off this advice by setting config variable advice.detachedHead to false

     Updating files: 100% (3558/3558), done.

I tried pod cache clean and install with the 10.0.0 tag. I see a difference in that it has --single-branch --depth 1 for the clone. It's obviously not an issue from your PR. I suspect it was just taking a lot of time to download the whole repository.

leehack commented 1 year ago

@russellwheatley https://andresalla.com/en/stop-using-branch-in-your-podfiles/

russellwheatley commented 1 year ago

did it work using :tag =>?

leehack commented 1 year ago

@russellwheatley @russel/ios-10 is not a tag, so I can't do it. I don't know how long it will take but let me try to wait while I'm doing something else ;) I don't know what the tagging policy is in this repository, but if you could push a tag, that would help people try it out.

russellwheatley commented 1 year ago

@leehack The article you shared says you can use tag instead of branch and it will get the branch? Hence my question. Not pushing a tag until the next iOS SDK update. This is a temporary measure, it won't get merged (and subsequently tagged) until we're sure it's a solution. I'm awaiting feedback from users. Thus far, you're the only one not able to pod install.

leehack commented 1 year ago

@russellwheatley Finally, the download is complete. It took around 20min ;) I also confirm the tag works. No need to push a tag.

leehack commented 1 year ago

I also confirm that the ios build worked as well for my flutter project.