I've added
pod 'BugfenderSDK', '1.8', :configurations => ['Debug_dev', 'Release_dev']
pod 'Firebase/Crashlytics', '6.21.0', :configurations => ['Debug_dev', 'Release_dev']
to my Podfile and ran pod install command
Having BugfenderSDK and Firebase/Crashlytics frameworks embedded in final IPA files only when built with 'Debug_dev' and 'Release_dev' configurations.
BugFenderSDK framework is indeed visible only in IPA'a built via 'Debug_dev' / 'Release_dev', but Firebase is visible on all possible configurations that I'm building my app.
CocoaPods : 1.9.1
Ruby : ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19]
RubyGems : 3.0.3
Host : Mac OS X 10.15.3 (19D76)
Xcode : 11.3.1 (11C505)
Git : git version 2.25.0
Ruby lib dir : /Users/axadiw/.rbenv/versions/2.6.5/lib
Repositories : master - git - https://github.com/CocoaPods/Specs.git @ 590bdf0b22f980c4923a83e8a80bd034a1518c00
trunk - CDN - https://cdn.cocoapods.org/
Executable Path: /Users/axadiw/.rbenv/versions/2.6.5/bin/pod
cocoapods-deintegrate : 1.0.4
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.1.0
cocoapods-trunk : 1.4.1
cocoapods-try : 1.1.0
platform :ios, '12.0'
inhibit_all_warnings!
use_frameworks!
target 'MyProject' do
pod 'FirebaseCrashlytics', '4.0.0-beta.6', :configurations => ['Debug_dev', 'Release_dev']
pod 'BugfenderSDK', '1.8', :configurations => ['Debug_dev', 'Release_dev']
end
PS. Posted originally on https://github.com/firebase/firebase-ios-sdk/issues/5217
Thanks for the report. Please share a reproducible example.
Sure: https://github.com/Axadiw/cocoapods-configuration-issue
Archives from "dev" schem have bugfender & firebase frameworks, scheme "prod" still have firebase
Thanks. I'm able to reproduce.
It looks like the :configuration restriction in the Podfile only applies to specified pod itself and not the pod's dependencies. Thus in your example, the Firebase pod is excluded from the configuration's build, but none of its transitive dependencies are.
Therefore, a workaround would be to explicitly specify and restrict each of the dependencies in the Podfile: FirebaseCrashlytics, FirebaseCore, GoogleUtiliites, etc. See the Podfile.lock to see the full list.
Then you can verify they get removed by
git diff "Pods/Target Support Files/Pods-cocoapods-configuration-issue/Pods-cocoapods-configuration-issue.release_dev.xcconfig" in the example project you provided.
If I get a chance, I'll try to investigate why CocoaPods doesn't properly limit the dependencies to the right configurations. It might be tricky since it might not be easy to do separate dependency trees for each configuration ....
Thanks, it's working for me when I've explicitly mentioned everyting that stands for Crashlytics
pod 'Firebase', '6.21.0', :configurations => ['Debug_dev', 'Release_dev']
pod 'FirebaseAnalyticsInterop', '1.5.0', :configurations => ['Debug_dev', 'Release_dev']
pod 'FirebaseCore', '6.6.5', :configurations => ['Debug_dev', 'Release_dev']
pod 'FirebaseCoreDiagnostics', '1.2.2', :configurations => ['Debug_dev', 'Release_dev']
pod 'FirebaseCoreDiagnosticsInterop', '1.2.0', :configurations => ['Debug_dev', 'Release_dev']
pod 'FirebaseCrashlytics', '4.0.0-beta.6', :configurations => ['Debug_dev', 'Release_dev']
pod 'FirebaseInstallations', '1.1.1', :configurations => ['Debug_dev', 'Release_dev']
pod 'GoogleDataTransport', '5.1.0', :configurations => ['Debug_dev', 'Release_dev']
pod 'GoogleDataTransportCCTSupport', '2.0.1', :configurations => ['Debug_dev', 'Release_dev']
pod 'GoogleUtilities', '6.5.2', :configurations => ['Debug_dev', 'Release_dev']
pod 'PromisesObjC', '1.2.8', :configurations => ['Debug_dev', 'Release_dev']
pod 'nanopb', '0.3.9011', :configurations => ['Debug_dev', 'Release_dev']
pod 'FirebaseAnalytics', '6.4.0', :configurations => ['Debug_dev', 'Release_dev']
pod 'GoogleAppMeasurement', '6.4.0', :configurations => ['Debug_dev', 'Release_dev']
BTW. I still see that when I'm building other configurations ("prod" ones from the example app), all firebase dependencies are being built anyways. Is it normal behaviour? Would it be possible to skip these builds in order to save compile time?
This problem is similar to one that is currently affecting the latest version of React Native (0.62):
https://github.com/react-native-community/upgrade-support/issues/28
Listing all the transitive dependencies would stop working as soon as you update the problematic pod and that pod has changed its dependencies. So this approach would constantly force you to be checking Podfile.lock to identify all transitive dependencies that needs to be excluded and move them to the Podfile. Not ideal IMHO.
Would it be possible to have cocoapods exclude all dependencies of the excluded pods?
Thanks!
Regarding:
BTW. I still see that when I'm building other configurations ("prod" ones from the example app), all firebase dependencies are being built anyways. Is it normal behaviour? Would it be possible to skip these builds in order to save compile time?
I do not think building can be avoided as the dependency is mapped on Xcode using the "Dependencies" section in Build Phases for each target.
I do not think Xcode supports dependencies per configuration.
The important bit is whether or not the dependency gets linked. If you have specified "Debug" and you see -framework MyDependency or-l MyDependency in the CocoaPods generated xcconfig for "Release" for that target then it is a bug in CocoaPods. Although this is very thoroughly tested.
We would need to implement an enhancement to support this.
This has come up before and I attempted to fix it but struggled to handle some cases.
Here's the PR: https://github.com/CocoaPods/CocoaPods/pull/9066
Original Issue: https://github.com/CocoaPods/CocoaPods/issues/6838
The branch is still up if anyone wants to try updating it. There's some comments on the PR explaining what needs to be improved
Thanks, it's working for me when I've explicitly mentioned everyting that stands for Crashlytics
pod 'Firebase', '6.21.0', :configurations => ['Debug_dev', 'Release_dev'] pod 'FirebaseAnalyticsInterop', '1.5.0', :configurations => ['Debug_dev', 'Release_dev'] pod 'FirebaseCore', '6.6.5', :configurations => ['Debug_dev', 'Release_dev'] pod 'FirebaseCoreDiagnostics', '1.2.2', :configurations => ['Debug_dev', 'Release_dev'] pod 'FirebaseCoreDiagnosticsInterop', '1.2.0', :configurations => ['Debug_dev', 'Release_dev'] pod 'FirebaseCrashlytics', '4.0.0-beta.6', :configurations => ['Debug_dev', 'Release_dev'] pod 'FirebaseInstallations', '1.1.1', :configurations => ['Debug_dev', 'Release_dev'] pod 'GoogleDataTransport', '5.1.0', :configurations => ['Debug_dev', 'Release_dev'] pod 'GoogleDataTransportCCTSupport', '2.0.1', :configurations => ['Debug_dev', 'Release_dev'] pod 'GoogleUtilities', '6.5.2', :configurations => ['Debug_dev', 'Release_dev'] pod 'PromisesObjC', '1.2.8', :configurations => ['Debug_dev', 'Release_dev'] pod 'nanopb', '0.3.9011', :configurations => ['Debug_dev', 'Release_dev'] pod 'FirebaseAnalytics', '6.4.0', :configurations => ['Debug_dev', 'Release_dev'] pod 'GoogleAppMeasurement', '6.4.0', :configurations => ['Debug_dev', 'Release_dev']BTW. I still see that when I'm building other configurations ("prod" ones from the example app), all firebase dependencies are being built anyways. Is it normal behaviour? Would it be possible to skip these builds in order to save compile time?
Hi,
By the way, you can put this in a vatiable: ['Debug_dev', 'Release_dev']
$firebaseConfigurations = ['Debug_dev', 'Release_dev']
pod 'Firebase', '6.21.0', :configurations => $firebaseConfigurations
pod 'FirebaseAnalyticsInterop', '1.5.0', :configurations => $firebaseConfigurations
Best regards,
Most helpful comment
We would need to implement an enhancement to support this.