Browse Source

New and clearer FirebaseAnalytics subspecs (#14882)

The new subspecs: Default, Core, and IdentitySupport.

The previous subspecs that are now deprecated: AdIdSupport (use IdentitySupport) and WithoutAdIdSupport (use Core).
pcfba 10 months ago
parent
commit
4f6c342424

+ 19 - 2
FirebaseAnalytics.podspec

@@ -34,13 +34,30 @@ Pod::Spec.new do |s|
     s.dependency 'GoogleUtilities/Network', '~> 8.1'
     s.dependency 'nanopb', '~> 3.30910.0'
 
-    s.default_subspecs = 'AdIdSupport'
+    s.default_subspecs = 'Default'
 
+    s.subspec 'Default' do |ss|
+        ss.dependency 'GoogleAppMeasurement/Default', '11.14.0'
+        ss.vendored_frameworks = 'Frameworks/FirebaseAnalytics.xcframework'
+    end
+
+    s.subspec 'Core' do |ss|
+        ss.dependency 'GoogleAppMeasurement/Core', '11.14.0'
+        ss.vendored_frameworks = 'Frameworks/FirebaseAnalytics.xcframework'
+    end
+
+    s.subspec 'IdentitySupport' do |ss|
+        ss.dependency 'GoogleAppMeasurement/IdentitySupport', '11.14.0'
+        ss.vendored_frameworks = 'Frameworks/FirebaseAnalytics.xcframework'
+    end
+
+    # Deprecated. Use IdentitySupport subspec instead.
     s.subspec 'AdIdSupport' do |ss|
-        ss.dependency 'GoogleAppMeasurement', '11.14.0'
+        ss.dependency 'GoogleAppMeasurement/AdIdSupport', '11.14.0'
         ss.vendored_frameworks = 'Frameworks/FirebaseAnalytics.xcframework'
     end
 
+    # Deprecated. Use Core subspec instead.
     s.subspec 'WithoutAdIdSupport' do |ss|
         ss.dependency 'GoogleAppMeasurement/WithoutAdIdSupport', '11.14.0'
         ss.vendored_frameworks = 'Frameworks/FirebaseAnalytics.xcframework'

+ 17 - 0
FirebaseAnalyticsCoreWrapper/dummy.m

@@ -0,0 +1,17 @@
+/*
+ * Copyright 2021 Google LLC
+ *
+ * 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.
+ */
+
+// Swift Package Manager needs at least one source file.

+ 18 - 0
FirebaseAnalyticsCoreWrapper/include/dummy.h

@@ -0,0 +1,18 @@
+/*
+ * Copyright 2021 Google LLC
+ *
+ * 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.
+ */
+
+// Swift Package Manager needs at least one header to prevent a warning. See
+// https://github.com/firebase/firebase-ios-sdk/pull/6504.

+ 17 - 0
FirebaseAnalyticsIdentitySupportWrapper/dummy.m

@@ -0,0 +1,17 @@
+/*
+ * Copyright 2021 Google LLC
+ *
+ * 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.
+ */
+
+// Swift Package Manager needs at least one source file.

+ 18 - 0
FirebaseAnalyticsIdentitySupportWrapper/include/dummy.h

@@ -0,0 +1,18 @@
+/*
+ * Copyright 2021 Google LLC
+ *
+ * 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.
+ */
+
+// Swift Package Manager needs at least one header to prevent a warning. See
+// https://github.com/firebase/firebase-ios-sdk/pull/6504.

+ 3 - 0
FirebaseAnalyticsOnDeviceConversionWrapper/dummy.m

@@ -15,3 +15,6 @@
  */
 
 // Swift Package Manager needs at least one source file.
+
+// #warning "FirebaseAnalyticsOnDeviceConversion is deprecated. Use GoogleAdsOnDeviceConversion from
+// https://github.com/googleads/google-ads-on-device-conversion-ios-sdk/ instead."

+ 2 - 0
FirebaseAnalyticsWithoutAdIdSupportWrapper/dummy.m

@@ -15,3 +15,5 @@
  */
 
 // Swift Package Manager needs at least one source file.
+
+// #warning "FirebaseAnalyticsWithoutAdIdSupport is deprecated. Use FirebaseAnalyticsCore instead."

+ 21 - 5
GoogleAppMeasurement.podspec

@@ -34,15 +34,31 @@ Pod::Spec.new do |s|
     s.dependency 'GoogleUtilities/Network', '~> 8.1'
     s.dependency 'nanopb', '~> 3.30910.0'
 
-    s.default_subspecs = 'AdIdSupport'
+    s.default_subspecs = 'Default'
 
-    s.subspec 'AdIdSupport' do |ss|
-        ss.dependency 'GoogleAppMeasurement/WithoutAdIdSupport', '11.14.0'
-        ss.vendored_frameworks = 'Frameworks/GoogleAppMeasurementIdentitySupport.xcframework'
+    s.subspec 'Default' do |ss|
+        ss.dependency 'GoogleAppMeasurement/Core', '11.14.0'
+        ss.dependency 'GoogleAppMeasurement/IdentitySupport', '11.14.0'
+        # TODO Update to 2.0.0
+        ss.ios.dependency 'GoogleAdsOnDeviceConversion', '1.3.0'
     end
 
-    s.subspec 'WithoutAdIdSupport' do |ss|
+    s.subspec 'Core' do |ss|
         ss.vendored_frameworks = 'Frameworks/GoogleAppMeasurement.xcframework'
     end
 
+    s.subspec 'IdentitySupport' do |ss|
+        ss.dependency 'GoogleAppMeasurement/Core', '11.14.0'
+        ss.vendored_frameworks = 'Frameworks/GoogleAppMeasurementIdentitySupport.xcframework'
+    end
+
+    # Deprecated. Use IdentitySupport subspec instead.
+    s.subspec 'AdIdSupport' do |ss|
+        ss.dependency 'GoogleAppMeasurement/IdentitySupport', '11.14.0'
+    end
+
+    # Deprecated. Use Core subspec instead.
+    s.subspec 'WithoutAdIdSupport' do |ss|
+        ss.dependency 'GoogleAppMeasurement/Core', '11.14.0'
+    end
 end

+ 75 - 0
Package.swift

@@ -43,10 +43,25 @@ let package = Package(
     ),
     // Adding this library to your project is enough for it to take effect. The module
     // does not need to be imported into any source files.
+    .library(
+      name: "FirebaseAnalyticsCore",
+      targets: ["FirebaseAnalyticsCoreTarget"]
+    ),
+    // Adding this library to your project is enough for it to take effect. The module
+    // does not need to be imported into any source files.
+    .library(
+      name: "FirebaseAnalyticsIdentitySupport",
+      targets: ["FirebaseAnalyticsIdentitySupportTarget"]
+    ),
+    // Deprecated. Use FirebaseAnalyticsCore instead.
+    // Adding this library to your project is enough for it to take effect. The module
+    // does not need to be imported into any source files.
     .library(
       name: "FirebaseAnalyticsWithoutAdIdSupport",
       targets: ["FirebaseAnalyticsWithoutAdIdSupportTarget"]
     ),
+    // Deprecated. Use GoogleAdsOnDeviceConversion from
+    // https://github.com/googleads/google-ads-on-device-conversion-ios-sdk/ instead.
     // Adding this library to your project is enough for it to take effect. The module
     // does not need to be imported into any source files.
     .library(
@@ -374,6 +389,66 @@ let package = Package(
       path: "FirebaseAnalytics/Tests/ObjCAPI"
     ),
 
+    .target(
+      name: "FirebaseAnalyticsCoreTarget",
+      dependencies: [.target(name: "FirebaseAnalyticsCoreWrapper",
+                             condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS]))],
+      path: "SwiftPM-PlatformExclude/FirebaseAnalyticsCoreWrap"
+    ),
+    .target(
+      name: "FirebaseAnalyticsCoreWrapper",
+      dependencies: [
+        .target(
+          name: "FirebaseAnalytics",
+          condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
+        ),
+        .product(name: "GoogleAppMeasurementCore",
+                 package: "GoogleAppMeasurement",
+                 condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])),
+        "FirebaseCore",
+        "FirebaseInstallations",
+        .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
+        .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
+        .product(name: "GULNSData", package: "GoogleUtilities"),
+        .product(name: "GULNetwork", package: "GoogleUtilities"),
+        .product(name: "nanopb", package: "nanopb"),
+      ],
+      path: "FirebaseAnalyticsCoreWrapper",
+      linkerSettings: [
+        .linkedLibrary("sqlite3"),
+        .linkedLibrary("c++"),
+        .linkedLibrary("z"),
+        .linkedFramework("StoreKit"),
+      ]
+    ),
+
+    .target(
+      name: "FirebaseAnalyticsIdentitySupportTarget",
+      dependencies: [
+        .target(
+          name: "FirebaseAnalytics",
+          condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])
+        ),
+        .product(name: "GoogleAppMeasurementIdentitySupport",
+                 package: "GoogleAppMeasurement",
+                 condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS])),
+        "FirebaseCore",
+        "FirebaseInstallations",
+        .product(name: "GULAppDelegateSwizzler", package: "GoogleUtilities"),
+        .product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
+        .product(name: "GULNSData", package: "GoogleUtilities"),
+        .product(name: "GULNetwork", package: "GoogleUtilities"),
+        .product(name: "nanopb", package: "nanopb"),
+      ],
+      path: "FirebaseAnalyticsIdentitySupportWrapper",
+      linkerSettings: [
+        .linkedLibrary("sqlite3"),
+        .linkedLibrary("c++"),
+        .linkedLibrary("z"),
+        .linkedFramework("StoreKit"),
+      ]
+    ),
+
     .target(
       name: "FirebaseAnalyticsWithoutAdIdSupportTarget",
       dependencies: [.target(name: "FirebaseAnalyticsWithoutAdIdSupportWrapper",

+ 18 - 0
SwiftPM-PlatformExclude/FirebaseAnalyticsCoreWrap/dummy.m

@@ -0,0 +1,18 @@
+// Copyright 2020 Google LLC
+//
+// 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 <TargetConditionals.h>
+#if TARGET_OS_WATCH
+#warning "Firebase Analytics does not support the watchOS platform"
+#endif

+ 15 - 0
SwiftPM-PlatformExclude/FirebaseAnalyticsCoreWrap/include/dummy.h

@@ -0,0 +1,15 @@
+// Copyright 2020 Google LLC
+//
+// 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.
+
+// Prevent a missing umbrella header warning.