Forráskód Böngészése

Stop requiring pods to be static frameworks (#6557)

Paul Beusterien 5 éve
szülő
commit
3ca4e99c0e
37 módosított fájl, 200 hozzáadás és 143 törlés
  1. 0 2
      AddNewPod.md
  2. 0 1
      FirebaseABTesting.podspec
  3. 0 1
      FirebaseAppDistribution.podspec
  4. 0 1
      FirebaseAuth.podspec
  5. 12 6
      FirebaseCore.podspec
  6. 3 0
      FirebaseCore/CHANGELOG.md
  7. 1 0
      FirebaseCore/Tests/SwiftUnit/FirebaseAppTests.swift
  8. 1 0
      FirebaseCore/Tests/SwiftUnit/FirebaseCore-unit-Bridging-Header.h
  9. 2 4
      FirebaseCore/Tests/Unit/FIRAppTest.m
  10. 1 0
      FirebaseCore/Tests/Unit/FIRBundleUtilTest.m
  11. 1 1
      FirebaseCore/Tests/Unit/FIRComponentContainerTest.m
  12. 4 9
      FirebaseCore/Tests/Unit/FIROptionsTest.m
  13. 0 21
      FirebaseCore/Tests/Unit/FIRTestCase.h
  14. 0 46
      FirebaseCore/Tests/Unit/FIRTestCase.m
  15. 0 1
      FirebaseCoreDiagnostics.podspec
  16. 0 1
      FirebaseCrashlytics.podspec
  17. 16 9
      FirebaseDatabase.podspec
  18. 2 3
      FirebaseDatabase/Tests/Helpers/FTestBase.m
  19. 0 1
      FirebaseDynamicLinks.podspec
  20. 0 1
      FirebaseFirestore.podspec
  21. 0 1
      FirebaseFirestoreSwift.podspec
  22. 0 1
      FirebaseFunctions.podspec
  23. 0 1
      FirebaseInAppMessaging.podspec
  24. 9 6
      FirebaseInAppMessaging/Sources/DefaultUI/FIRIAMDefaultDisplayImpl.m
  25. 0 1
      FirebaseInstallations.podspec
  26. 0 1
      FirebaseInstanceID.podspec
  27. 0 1
      FirebaseMessaging.podspec
  28. 0 1
      FirebaseRemoteConfig.podspec
  29. 29 14
      FirebaseRemoteConfig/Tests/Unit/RCNRemoteConfigTest.m
  30. 0 1
      FirebaseStorage.podspec
  31. 0 1
      FirebaseStorageSwift.podspec
  32. 0 1
      GoogleDataTransport.podspec
  33. 0 1
      GoogleUtilitiesComponents.podspec
  34. 2 2
      Package.swift
  35. 45 0
      SharedTestUtilities/FIROptionsMock.h
  36. 59 0
      SharedTestUtilities/FIROptionsMock.m
  37. 13 2
      docs/firebase_in_libraries.md

+ 0 - 2
AddNewPod.md

@@ -13,8 +13,6 @@ detailed instructions. Some Firebase specific guidance below:
 * `s.deployment_target` - Ideally should include ios, osx, and tvos. See
 [FirebaseCore.podspec](FirebaseCore.podspec) for the current Firebase minimum version settings.
 
-* `s.static_framework` - By default, Firebase pods should be static frameworks.
-
 * `s.dependency` - Dependencies on other Firebase pods and pods in this repo should specify a
 version and allow minor version updates - like `s.dependency 'FirebaseCore', '~> 6.6'`. When
 initially defined, choose the most recently released minor version of the dependency.

+ 0 - 1
FirebaseABTesting.podspec

@@ -25,7 +25,6 @@ Firebase Cloud Messaging and Firebase Remote Config in your app.
   s.tvos.deployment_target = '10.0'
 
   s.cocoapods_version = '>= 1.4.0'
-  s.static_framework = true
   s.prefix_header_file = false
 
   base_dir = "FirebaseABTesting/Sources/"

+ 0 - 1
FirebaseAppDistribution.podspec

@@ -18,7 +18,6 @@ iOS SDK for App Distribution for Firebase.
   s.ios.deployment_target = '10.0'
 
   s.cocoapods_version = '>= 1.4.0'
-  s.static_framework = true
   s.prefix_header_file = false
 
   base_dir = "FirebaseAppDistribution/Sources/"

+ 0 - 1
FirebaseAuth.podspec

@@ -23,7 +23,6 @@ supports email and password accounts, as well as several 3rd party authenticatio
   s.watchos.deployment_target = '6.0'
 
   s.cocoapods_version = '>= 1.4.0'
-  s.static_framework = true
   s.prefix_header_file = false
 
   source = 'FirebaseAuth/Sources/'

+ 12 - 6
FirebaseCore.podspec

@@ -22,7 +22,6 @@ Firebase Core includes FIRApp and FIROptions which provide central configuration
   s.watchos.deployment_target = '6.0'
 
   s.cocoapods_version = '>= 1.4.0'
-  s.static_framework = true
   s.prefix_header_file = false
 
   s.source_files = [
@@ -54,7 +53,10 @@ Firebase Core includes FIRApp and FIROptions which provide central configuration
   }
   s.test_spec 'unit' do |unit_tests|
     unit_tests.platforms = {:ios => '8.0', :osx => '10.11', :tvos => '10.0'}
-    unit_tests.source_files = 'FirebaseCore/Tests/Unit/**/*.[mh]'
+    unit_tests.source_files = [
+      'FirebaseCore/Tests/Unit/**/*.[mh]',
+      'SharedTestUtilities/FIROptionsMock.[mh]',
+    ]
     unit_tests.requires_app_host = true
     unit_tests.dependency 'OCMock'
     unit_tests.resources = 'FirebaseCore/Tests/Unit/Resources/GoogleService-Info.plist'
@@ -62,12 +64,16 @@ Firebase Core includes FIRApp and FIROptions which provide central configuration
 
   s.test_spec 'swift-unit' do |swift_unit_tests|
     swift_unit_tests.platforms = {:ios => '8.0', :osx => '10.11', :tvos => '10.0'}
-    swift_unit_tests.source_files = 'FirebaseCore/Tests/SwiftUnit/**/*.swift',
-                                    'FirebaseCore/Tests/SwiftUnit/**/*.h',
-                                    'FirebaseCore/Tests/SwiftUnit/SwiftTestingUtilities/*'
-    swift_unit_tests.resources = 'FirebaseCore/Tests/Unit/Resources/GoogleService-Info.plist'
+    swift_unit_tests.source_files = [
+      'FirebaseCore/Tests/SwiftUnit/**/*.swift',
+      'FirebaseCore/Tests/SwiftUnit/**/*.h',
+      'FirebaseCore/Tests/SwiftUnit/SwiftTestingUtilities/*',
+      'SharedTestUtilities/FIROptionsMock.[mh]',
+    ]
     swift_unit_tests.pod_target_xcconfig = {
       'SWIFT_OBJC_BRIDGING_HEADER' => '$(PODS_TARGET_SRCROOT)/FirebaseCore/Tests/SwiftUnit/FirebaseCore-unit-Bridging-Header.h'
     }
+    swift_unit_tests.dependency 'OCMock'
+    swift_unit_tests.resources = 'FirebaseCore/Tests/Unit/Resources/GoogleService-Info.plist'
   end
 end

+ 3 - 0
FirebaseCore/CHANGELOG.md

@@ -2,6 +2,9 @@
 - [changed] Update minimum iOS version to iOS 10 except for Analytics which is now iOS 9. (#4847)
 - [changed] Update minimum macOS version to 10.12.
 - [added] Swift Package Manager support for Firebase Messaging. (#5641)
+- [changed] The pods developed in this repo are no longer hard coded to be built as static
+  frameworks. Instead, their linkage will be controlled by the Podfile. Use the Podfile
+  option `use_frameworks! :linkage => :static` to get the Firebase 6.x linkage behavior. (#2022)
 
 # Firebase 6.33.0
 - [fixed] Swift Package Manager - Define system framework and system library dependencies. This

+ 1 - 0
FirebaseCore/Tests/SwiftUnit/FirebaseAppTests.swift

@@ -23,6 +23,7 @@ private extension Constants {
 class FirebaseAppTests: XCTestCase {
   override func setUp() {
     super.setUp()
+    FIROptionsMock.mockFIROptions()
   }
 
   override func tearDown() {

+ 1 - 0
FirebaseCore/Tests/SwiftUnit/FirebaseCore-unit-Bridging-Header.h

@@ -14,3 +14,4 @@
 
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
 #import "FirebaseCore/Tests/SwiftUnit/SwiftTestingUtilities/ExceptionCatcher.h"
+#import "SharedTestUtilities/FIROptionsMock.h"

+ 2 - 4
FirebaseCore/Tests/Unit/FIRAppTest.m

@@ -19,8 +19,8 @@
 #import "FirebaseCore/Sources/Private/FIRAppInternal.h"
 #import "FirebaseCore/Sources/Private/FIRCoreDiagnosticsConnector.h"
 #import "FirebaseCore/Sources/Private/FIROptionsInternal.h"
-
 #import "GoogleUtilities/Environment/Private/GULAppEnvironmentUtil.h"
+#import "SharedTestUtilities/FIROptionsMock.h"
 
 NSString *const kFIRTestAppName1 = @"test_app_name_1";
 NSString *const kFIRTestAppName2 = @"test-app-name-2";
@@ -68,9 +68,7 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
   _observerMock = OCMObserverMock();
   _mockCoreDiagnosticsConnector = OCMClassMock([FIRCoreDiagnosticsConnector class]);
 
-#if SWIFT_PACKAGE
-  [self mockFIROptions];
-#endif
+  [FIROptionsMock mockFIROptions];
 
   OCMStub(ClassMethod([self.mockCoreDiagnosticsConnector logCoreTelemetryWithOptions:[OCMArg any]]))
       .andDo(^(NSInvocation *invocation){

+ 1 - 0
FirebaseCore/Tests/Unit/FIRBundleUtilTest.m

@@ -16,6 +16,7 @@
 
 #import "FirebaseCore/Sources/FIRBundleUtil.h"
 #import "GoogleUtilities/Environment/Private/GULAppEnvironmentUtil.h"
+#import "SharedTestUtilities/FIROptionsMock.h"
 
 static NSString *const kResultPath = @"resultPath";
 static NSString *const kResourceName = @"resourceName";

+ 1 - 1
FirebaseCore/Tests/Unit/FIRComponentContainerTest.m

@@ -16,8 +16,8 @@
 
 #import "FirebaseCore/Sources/FIRComponentContainerInternal.h"
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
-
 #import "FirebaseCore/Tests/Unit/FIRTestComponents.h"
+#import "SharedTestUtilities/FIROptionsMock.h"
 
 /// Internally exposed methods and properties for testing.
 @interface FIRComponentContainer (TestInternal)

+ 4 - 9
FirebaseCore/Tests/Unit/FIROptionsTest.m

@@ -18,6 +18,7 @@
 #import "FirebaseCore/Sources/FIRVersion.h"
 #import "FirebaseCore/Sources/Private/FIRAppInternal.h"
 #import "FirebaseCore/Sources/Private/FIROptionsInternal.h"
+#import "SharedTestUtilities/FIROptionsMock.h"
 
 extern NSString *const kFIRIsMeasurementEnabled;
 extern NSString *const kFIRIsAnalyticsCollectionEnabled;
@@ -43,9 +44,7 @@ extern NSString *const kFIRLibraryVersionID;
 }
 
 - (void)testInit {
-#if SWIFT_PACKAGE
-  [self mockFIROptions];
-#endif
+  [FIROptionsMock mockFIROptions];
   NSDictionary *optionsDictionary = [FIROptions defaultOptionsDictionary];
   FIROptions *options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
   [self assertOptionsMatchDefaults:options andProjectID:YES];
@@ -75,9 +74,7 @@ extern NSString *const kFIRLibraryVersionID;
 }
 
 - (void)testDefaultOptions {
-#if SWIFT_PACKAGE
-  [self mockFIROptions];
-#endif
+  [FIROptionsMock mockFIROptions];
   FIROptions *options = [FIROptions defaultOptions];
   [self assertOptionsMatchDefaults:options andProjectID:YES];
   XCTAssertNil(options.deepLinkURLScheme);
@@ -242,9 +239,7 @@ extern NSString *const kFIRLibraryVersionID;
 }
 
 - (void)testCopyWithZone {
-#if SWIFT_PACKAGE
-  [self mockFIROptions];
-#endif
+  [FIROptionsMock mockFIROptions];
   // default options
   FIROptions *options = [FIROptions defaultOptions];
   options.deepLinkURLScheme = kDeepLinkURLScheme;

+ 0 - 21
FirebaseCore/Tests/Unit/FIRTestCase.h

@@ -17,29 +17,8 @@
 #import <XCTest/XCTest.h>
 #import "OCMock.h"
 
-NS_ASSUME_NONNULL_BEGIN
-
-extern NSString *const kAPIKey;
-extern NSString *const kCustomizedAPIKey;
-extern NSString *const kClientID;
-extern NSString *const kTrackingID;
-extern NSString *const kGCMSenderID;
-extern NSString *const kAndroidClientID;
-extern NSString *const kGoogleAppID;
-extern NSString *const kDatabaseURL;
-extern NSString *const kStorageBucket;
-
-extern NSString *const kDeepLinkURLScheme;
-extern NSString *const kNewDeepLinkURLScheme;
-
-extern NSString *const kBundleID;
-extern NSString *const kProjectID;
-
 /**
  * Base test case for Firebase Core SDK tests.
  */
 @interface FIRTestCase : XCTestCase
-- (void)mockFIROptions;
 @end
-
-NS_ASSUME_NONNULL_END

+ 0 - 46
FirebaseCore/Tests/Unit/FIRTestCase.m

@@ -14,24 +14,6 @@
 
 #import "FirebaseCore/Tests/Unit/FIRTestCase.h"
 
-#import "FirebaseCore/Sources/Private/FIROptionsInternal.h"
-
-NSString *const kAndroidClientID = @"correct_android_client_id";
-NSString *const kAPIKey = @"correct_api_key";
-NSString *const kCustomizedAPIKey = @"customized_api_key";
-NSString *const kClientID = @"correct_client_id";
-NSString *const kTrackingID = @"correct_tracking_id";
-NSString *const kGCMSenderID = @"correct_gcm_sender_id";
-NSString *const kGoogleAppID = @"1:123:ios:123abc";
-NSString *const kDatabaseURL = @"https://abc-xyz-123.firebaseio.com";
-NSString *const kStorageBucket = @"project-id-123.storage.firebase.com";
-
-NSString *const kDeepLinkURLScheme = @"comgoogledeeplinkurl";
-NSString *const kNewDeepLinkURLScheme = @"newdeeplinkurlfortest";
-
-NSString *const kBundleID = @"com.google.FirebaseSDKTests";
-NSString *const kProjectID = @"abc-xyz-123";
-
 @interface FIRTestCase ()
 
 @end
@@ -42,34 +24,6 @@ NSString *const kProjectID = @"abc-xyz-123";
   [super setUp];
 }
 
-// Swift Package manager does not allow a test project to override a bundle in an app (or library).
-- (void)mockFIROptions {
-  // Keys for the strings in the plist file.
-  NSString *const kFIRAPIKey = @"API_KEY";
-  NSString *const kFIRTrackingID = @"TRACKING_ID";
-  NSString *const kFIRGoogleAppID = @"GOOGLE_APP_ID";
-  NSString *const kFIRClientID = @"CLIENT_ID";
-  NSString *const kFIRGCMSenderID = @"GCM_SENDER_ID";
-  NSString *const kFIRDatabaseURL = @"DATABASE_URL";
-  NSString *const kFIRStorageBucket = @"STORAGE_BUCKET";
-  NSString *const kFIRBundleID = @"BUNDLE_ID";
-  NSString *const kFIRProjectID = @"PROJECT_ID";
-
-  NSDictionary<NSString *, NSString *> *mockDictionary = @{
-    kFIRAPIKey : kAPIKey,
-    kFIRBundleID : kBundleID,
-    kFIRClientID : kClientID,
-    kFIRDatabaseURL : kDatabaseURL,
-    kFIRGCMSenderID : kGCMSenderID,
-    kFIRGoogleAppID : kGoogleAppID,
-    kFIRProjectID : kProjectID,
-    kFIRStorageBucket : kStorageBucket,
-    kFIRTrackingID : kTrackingID,
-  };
-  id optionsClassMock = OCMClassMock([FIROptions class]);
-  OCMStub([optionsClassMock defaultOptionsDictionary]).andReturn(mockDictionary);
-}
-
 - (void)tearDown {
   [super tearDown];
 }

+ 0 - 1
FirebaseCoreDiagnostics.podspec

@@ -24,7 +24,6 @@ non-Cocoapod integration. This library also respects the Firebase global data co
   s.watchos.deployment_target = '6.0'
 
   s.cocoapods_version = '>= 1.4.0'
-  s.static_framework = true
   s.prefix_header_file = false
 
   header_search_paths = {

+ 0 - 1
FirebaseCrashlytics.podspec

@@ -17,7 +17,6 @@ Pod::Spec.new do |s|
   s.watchos.deployment_target = '6.0'
 
   s.cocoapods_version = '>= 1.4.0'
-  s.static_framework = true
   s.prefix_header_file = false
 
   s.source_files = [

+ 16 - 9
FirebaseDatabase.podspec

@@ -21,7 +21,6 @@ Simplify your iOS development, grow your user base, and monetize more effectivel
   s.tvos.deployment_target = '10.0'
 
   s.cocoapods_version = '>= 1.4.0'
-  s.static_framework = true
   s.prefix_header_file = false
 
   base_dir = "FirebaseDatabase/Sources/"
@@ -44,19 +43,27 @@ Simplify your iOS development, grow your user base, and monetize more effectivel
   }
 
   s.test_spec 'unit' do |unit_tests|
-    unit_tests.source_files = 'FirebaseDatabase/Tests/Unit/*.[mh]',
-                              'FirebaseDatabase/Tests/Helpers/*.[mh]',
-                              'FirebaseDatabase/Tests/third_party/*.[mh]',
-                              'SharedTestUtilities/FIRAuthInteropFake.[mh]',
-                              'SharedTestUtilities/FIRComponentTestUtilities.h'
+    unit_tests.source_files = [
+      'FirebaseDatabase/Tests/Unit/*.[mh]',
+      'FirebaseDatabase/Tests/Helpers/*.[mh]',
+      'FirebaseDatabase/Tests/third_party/*.[mh]',
+      'SharedTestUtilities/FIRAuthInteropFake.[mh]',
+      'SharedTestUtilities/FIRComponentTestUtilities.h',
+      'SharedTestUtilities/FIROptionsMock.[mh]',
+    ]
+    unit_tests.dependency 'OCMock'
     unit_tests.resources = 'FirebaseDatabase/Tests/Resources/syncPointSpec.json',
                            'FirebaseDatabase/Tests/Resources/GoogleService-Info.plist'
   end
 
   s.test_spec 'integration' do |int_tests|
-    int_tests.source_files = 'FirebaseDatabase/Tests/Integration/*.[mh]',
-                             'FirebaseDatabase/Tests/Helpers/*.[mh]',
-                             'SharedTestUtilities/FIRAuthInteropFake.[mh]'
+    int_tests.source_files = [
+      'FirebaseDatabase/Tests/Integration/*.[mh]',
+      'FirebaseDatabase/Tests/Helpers/*.[mh]',
+      'SharedTestUtilities/FIRAuthInteropFake.[mh]',
+      'SharedTestUtilities/FIROptionsMock.[mh]',
+    ]
+    int_tests.dependency 'OCMock'
     int_tests.resources = 'FirebaseDatabase/Tests/Resources/GoogleService-Info.plist'
   end
 end

+ 2 - 3
FirebaseDatabase/Tests/Helpers/FTestBase.m

@@ -20,16 +20,15 @@
 #import "FirebaseDatabase/Tests/Helpers/FIRTestAuthTokenProvider.h"
 #import "FirebaseDatabase/Tests/Helpers/FTestAuthTokenGenerator.h"
 #import "FirebaseDatabase/Tests/Helpers/FTestBase.h"
+#import "SharedTestUtilities/FIROptionsMock.h"
 
 @implementation FTestBase
 
 + (void)setUp {
   static dispatch_once_t once;
   dispatch_once(&once, ^{
-#if !SWIFT_PACKAGE
-    // Disabled for now with SPM. configure is not needed for the unit tests.
+    [FIROptionsMock mockFIROptions];
     [FIRApp configure];
-#endif
   });
 }
 

+ 0 - 1
FirebaseDynamicLinks.podspec

@@ -19,7 +19,6 @@ Firebase Dynamic Links are deep links that enhance user experience and increase
   s.ios.deployment_target = '10.0'
 
   s.cocoapods_version = '>= 1.4.0'
-  s.static_framework = true
   s.prefix_header_file = false
 
   s.source_files = [

+ 0 - 1
FirebaseFirestore.podspec

@@ -21,7 +21,6 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
   s.tvos.deployment_target = '10.0'
 
   s.cocoapods_version = '>= 1.4.0'
-  s.static_framework = true
   s.prefix_header_file = false
 
   s.source_files = [

+ 0 - 1
FirebaseFirestoreSwift.podspec

@@ -27,7 +27,6 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
   s.tvos.deployment_target  = '10.0'
 
   s.cocoapods_version       = '>= 1.4.0'
-  s.static_framework        = true
   s.prefix_header_file      = false
 
   s.requires_arc            = true

+ 0 - 1
FirebaseFunctions.podspec

@@ -20,7 +20,6 @@ Cloud Functions for Firebase.
   s.tvos.deployment_target = '10.0'
 
   s.cocoapods_version = '>= 1.4.0'
-  s.static_framework = true
   s.prefix_header_file = false
 
   s.source_files = [

+ 0 - 1
FirebaseInAppMessaging.podspec

@@ -20,7 +20,6 @@ See more product details at https://firebase.google.com/products/in-app-messagin
   s.ios.deployment_target = '10.0'
 
   s.cocoapods_version = '>= 1.4.0'
-  s.static_framework = true
   s.prefix_header_file = false
 
   base_dir = "FirebaseInAppMessaging/"

+ 9 - 6
FirebaseInAppMessaging/Sources/DefaultUI/FIRIAMDefaultDisplayImpl.m

@@ -53,14 +53,17 @@
 + (NSBundle *)getViewResourceBundle {
   static NSBundle *resourceBundle;
   static dispatch_once_t onceToken;
+  Class myClass = [self class];
 
   dispatch_once(&onceToken, ^{
-    // TODO. This logic of finding the resource bundle may need to change once it's open
-    // sourced
-    NSBundle *containingBundle = [NSBundle mainBundle];
-    // This is assuming the display resource bundle is contained in the main bundle
-    NSURL *bundleURL = [containingBundle URLForResource:@"InAppMessagingDisplayResources"
-                                          withExtension:@"bundle"];
+    NSBundle *containingBundle;
+    NSURL *bundleURL;
+    // The containing bundle is different whether FIAM is statically or dynamically linked.
+    for (containingBundle in @[ [NSBundle mainBundle], [NSBundle bundleForClass:myClass] ]) {
+      bundleURL = [containingBundle URLForResource:@"InAppMessagingDisplayResources"
+                                     withExtension:@"bundle"];
+      if (bundleURL != nil) break;
+    }
     if (bundleURL == nil) {
       FIRLogWarning(kFIRLoggerInAppMessagingDisplay, @"I-FID100007",
                     @"FIAM Display Resource bundle "

+ 0 - 1
FirebaseInstallations.podspec

@@ -22,7 +22,6 @@ Pod::Spec.new do |s|
   s.watchos.deployment_target = '6.0'
 
   s.cocoapods_version = '>= 1.4.0'
-  s.static_framework = true
   s.prefix_header_file = false
 
   base_dir = "FirebaseInstallations/Source/"

+ 0 - 1
FirebaseInstanceID.podspec

@@ -24,7 +24,6 @@ services.
   s.watchos.deployment_target = '6.0'
 
   s.cocoapods_version = '>= 1.4.0'
-  s.static_framework = true
   s.prefix_header_file = false
 
   base_dir = "Firebase/InstanceID/"

+ 0 - 1
FirebaseMessaging.podspec

@@ -25,7 +25,6 @@ device, and it is completely free.
   s.watchos.deployment_target = '6.0'
 
   s.cocoapods_version = '>= 1.4.0'
-  s.static_framework = true
   s.prefix_header_file = false
 
   base_dir = "FirebaseMessaging/"

+ 0 - 1
FirebaseRemoteConfig.podspec

@@ -23,7 +23,6 @@ app update.
   s.tvos.deployment_target = '10.0'
 
   s.cocoapods_version = '>= 1.4.0'
-  s.static_framework = true
   s.prefix_header_file = false
 
   base_dir = "FirebaseRemoteConfig/Sources/"

+ 29 - 14
FirebaseRemoteConfig/Tests/Unit/RCNRemoteConfigTest.m

@@ -1143,22 +1143,42 @@ static NSString *UTCToLocal(NSString *utcTime) {
   return [dateFormatter stringFromDate:date];
 }
 
+// Manage different bundle locations for Swift Package Manager, CocoaPods static, CocoaPods dynamic.
+- (void)setDefaultsFor:(FIRRemoteConfig *)config namespace:(NSString *)namespace {
 #if SWIFT_PACKAGE
-- (NSDictionary *)getSPMDefaults {
   NSBundle *bundle = Firebase_RemoteConfigUnit_SWIFTPM_MODULE_BUNDLE();
   NSString *plistFile = [bundle pathForResource:@"Defaults-testInfo" ofType:@"plist"];
-  return [[NSDictionary alloc] initWithContentsOfFile:plistFile];
-}
+#else
+  NSBundle *bundle = [NSBundle mainBundle];
+  NSString *plistFile = [bundle pathForResource:@"Defaults-testInfo" ofType:@"plist"];
+  if (plistFile != nil) {
+    if (namespace) {
+      [config setDefaultsFromPlistFileName:@"Defaults-testInfo" namespace:namespace];
+    } else {
+      [config setDefaultsFromPlistFileName:@"Defaults-testInfo"];
+    }
+    return;
+  }
+  // We've linked dynamically and the plist file is in the test's bundle.
+  for (bundle in [NSBundle allBundles]) {
+    plistFile = [bundle pathForResource:@"Defaults-testInfo" ofType:@"plist"];
+    if (plistFile != nil) {
+      break;
+    }
+  }
 #endif
+  NSDictionary *defaults = [[NSDictionary alloc] initWithContentsOfFile:plistFile];
+  if (namespace) {
+    [config setDefaults:defaults namespace:namespace];
+  } else {
+    [config setDefaults:defaults];
+  }
+}
 
 - (void)testSetDefaultsFromPlist {
   for (int i = 0; i < RCNTestRCNumTotalInstances; i++) {
     FIRRemoteConfig *config = _configInstances[i];
-#if SWIFT_PACKAGE
-    [config setDefaults:[self getSPMDefaults]];
-#else
-    [config setDefaultsFromPlistFileName:@"Defaults-testInfo"];
-#endif
+    [self setDefaultsFor:config namespace:nil];
     XCTAssertEqualObjects(_configInstances[i][@"lastCheckTime"].stringValue,
                           UTCToLocal(@"2016-02-28 18:33:31"));
     XCTAssertEqual(_configInstances[i][@"isPaidUser"].boolValue, YES);
@@ -1185,12 +1205,7 @@ static NSString *UTCToLocal(NSString *utcTime) {
 - (void)testSetDefaultsAndNamespaceFromPlist {
   for (int i = 0; i < RCNTestRCNumTotalInstances; i++) {
     if (i == RCNTestRCInstanceDefault) {
-#if SWIFT_PACKAGE
-      [_configInstances[i] setDefaults:[self getSPMDefaults] namespace:RCNTestsPerfNamespace];
-#else
-      [_configInstances[i] setDefaultsFromPlistFileName:@"Defaults-testInfo"
-                                              namespace:RCNTestsPerfNamespace];
-#endif
+      [self setDefaultsFor:_configInstances[i] namespace:RCNTestsPerfNamespace];
       XCTAssertEqualObjects([_configInstances[i] configValueForKey:@"lastCheckTime"
                                                          namespace:RCNTestsPerfNamespace]
                                 .stringValue,

+ 0 - 1
FirebaseStorage.podspec

@@ -22,7 +22,6 @@ Firebase Storage provides robust, secure file uploads and downloads from Firebas
   s.watchos.deployment_target = '6.0'
 
   s.cocoapods_version = '>= 1.4.0'
-  s.static_framework = true
   s.prefix_header_file = false
 
   s.source_files = [

+ 0 - 1
FirebaseStorageSwift.podspec

@@ -24,7 +24,6 @@ Firebase Storage provides robust, secure file uploads and downloads from Firebas
   s.watchos.deployment_target = '6.0'
 
   s.cocoapods_version       = '>= 1.4.0'
-  s.static_framework        = true
   s.prefix_header_file      = false
 
   s.source_files = [

+ 0 - 1
GoogleDataTransport.podspec

@@ -23,7 +23,6 @@ Shared library for iOS SDK data transport needs.
   # To develop or run the tests, >= 1.8.0 must be installed.
   s.cocoapods_version = '>= 1.4.0'
 
-  s.static_framework = true
   s.prefix_header_file = false
 
   s.source_files = ['GoogleDataTransport/GDTCORLibrary/**/*',

+ 0 - 1
GoogleUtilitiesComponents.podspec

@@ -24,7 +24,6 @@ Not intended for direct public usage.
 
   s.cocoapods_version = '>= 1.4.0'
   s.prefix_header_file = false
-  s.static_framework = true
 
   s.source_files = 'GoogleUtilitiesComponents/Sources/**/*.[mh]'
   s.public_header_files = 'GoogleUtilitiesComponents/Sources/Public/*.h', 'GoogleUtilitiesComponents/Sources/Private/*.h'

+ 2 - 2
Package.swift

@@ -156,7 +156,7 @@ let package = Package(
     ),
     .testTarget(
       name: "CoreUnit",
-      dependencies: ["FirebaseCore", "OCMock"],
+      dependencies: ["FirebaseCore", "SharedTestUtilities", "OCMock"],
       path: "FirebaseCore/Tests/Unit",
       exclude: ["Resources/GoogleService-Info.plist"],
       cSettings: [
@@ -555,7 +555,7 @@ let package = Package(
 
     .target(
       name: "SharedTestUtilities",
-      dependencies: ["FirebaseCore"],
+      dependencies: ["FirebaseCore", "OCMock"],
       path: "SharedTestUtilities",
       publicHeadersPath: "./",
       cSettings: [

+ 45 - 0
SharedTestUtilities/FIROptionsMock.h

@@ -0,0 +1,45 @@
+/*
+ * Copyright 2017 Google
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import <XCTest/XCTest.h>
+#import "OCMock.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+extern NSString *const kAPIKey;
+extern NSString *const kCustomizedAPIKey;
+extern NSString *const kClientID;
+extern NSString *const kTrackingID;
+extern NSString *const kGCMSenderID;
+extern NSString *const kAndroidClientID;
+extern NSString *const kGoogleAppID;
+extern NSString *const kDatabaseURL;
+extern NSString *const kStorageBucket;
+
+extern NSString *const kDeepLinkURLScheme;
+extern NSString *const kNewDeepLinkURLScheme;
+
+extern NSString *const kBundleID;
+extern NSString *const kProjectID;
+
+/**
+ * Base test case for Firebase Core SDK tests.
+ */
+@interface FIROptionsMock : NSObject
++ (void)mockFIROptions;
+@end
+
+NS_ASSUME_NONNULL_END

+ 59 - 0
SharedTestUtilities/FIROptionsMock.m

@@ -0,0 +1,59 @@
+// Copyright 2017 Google
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#import "OCMock.h"
+
+#import "FirebaseCore/Sources/Private/FIROptionsInternal.h"
+#import "SharedTestUtilities/FIROptionsMock.h"
+
+NSString *const kAndroidClientID = @"correct_android_client_id";
+NSString *const kAPIKey = @"correct_api_key";
+NSString *const kCustomizedAPIKey = @"customized_api_key";
+NSString *const kClientID = @"correct_client_id";
+NSString *const kTrackingID = @"correct_tracking_id";
+NSString *const kGCMSenderID = @"correct_gcm_sender_id";
+NSString *const kGoogleAppID = @"1:123:ios:123abc";
+NSString *const kDatabaseURL = @"https://abc-xyz-123.firebaseio.com";
+NSString *const kStorageBucket = @"project-id-123.storage.firebase.com";
+
+NSString *const kDeepLinkURLScheme = @"comgoogledeeplinkurl";
+NSString *const kNewDeepLinkURLScheme = @"newdeeplinkurlfortest";
+
+NSString *const kBundleID = @"com.google.FirebaseSDKTests";
+NSString *const kProjectID = @"abc-xyz-123";
+
+@interface FIROptionsMock ()
+
+@end
+
+@implementation FIROptionsMock
+
+// Swift Package manager does not allow a test project to override a bundle in an app (or library).
++ (void)mockFIROptions {
+  NSDictionary<NSString *, NSString *> *mockDictionary = @{
+    kFIRAPIKey : kAPIKey,
+    kFIRBundleID : kBundleID,
+    kFIRClientID : kClientID,
+    kFIRDatabaseURL : kDatabaseURL,
+    kFIRGCMSenderID : kGCMSenderID,
+    kFIRGoogleAppID : kGoogleAppID,
+    kFIRProjectID : kProjectID,
+    kFIRStorageBucket : kStorageBucket,
+    kFIRTrackingID : kTrackingID,
+  };
+  id optionsClassMock = OCMClassMock([FIROptions class]);
+  OCMStub([optionsClassMock defaultOptionsDictionary]).andReturn(mockDictionary);
+}
+
+@end

+ 13 - 2
docs/firebase_in_libraries.md

@@ -1,7 +1,18 @@
+# Introduction
+
+Before the 7.0 release, all source code and binary Firebase SDKs are compiled as static frameworks.
+With Firebase 7.0, CocoaPods developers can control whether Firebase is linked statically or
+dynamically from the `Podfile`. Use the Podfile option `use_frameworks! :linkage => :static` to get
+the Firebase 6.x linkage behavior.
+
+The zip and Carthage distributions continue to only be built for static linking.
+
+The Swift Package Manager distribution follows the Swift Package Manager defaults which is
+currently static linking.
+
 # Using Firebase from a framework or a library
 
-Currently all source code and binary Firebase SDKs are compiled as static frameworks. Most
-of the time you’ll link these frameworks directly to your app targets, but in some cases
+ Most of the time you’ll link Firebase frameworks directly to your app targets, but in some cases
 it makes sense to link Firebase frameworks to your app indirectly, from another library or
 another framework. This note talks about some of the pitfalls of this technique, almost
 always hard-to-debug undefined behaviors, that all come down to code duplication and how