Skip to content

New and clearer FirebaseAnalytics subspecs #14882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions FirebaseAnalytics.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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 'AdIdSupport' do |ss|
s.subspec 'Default' do |ss|
ss.dependency 'GoogleAppMeasurement', '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/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'
Expand Down
17 changes: 17 additions & 0 deletions FirebaseAnalyticsCoreWrapper/dummy.m
Original file line number Diff line number Diff line change
@@ -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 changes: 18 additions & 0 deletions FirebaseAnalyticsCoreWrapper/include/dummy.h
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions FirebaseAnalyticsIdentitySupportWrapper/dummy.m
Original file line number Diff line number Diff line change
@@ -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 changes: 18 additions & 0 deletions FirebaseAnalyticsIdentitySupportWrapper/include/dummy.h
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions FirebaseAnalyticsOnDeviceConversionWrapper/dummy.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
*/

// Swift Package Manager needs at least one source file.

#warning "FirebaseAnalyticsOnDeviceConversion is deprecated. Use GoogleAdsOnDeviceConversion instead."
2 changes: 2 additions & 0 deletions FirebaseAnalyticsWithoutAdIdSupportWrapper/dummy.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
*/

// Swift Package Manager needs at least one source file.

#warning "FirebaseAnalyticsWithoutAdIdSupport is deprecated. Use FirebaseAnalyticsCore instead."
30 changes: 25 additions & 5 deletions GoogleAppMeasurement.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,35 @@ 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', 'GoogleAdsOnDeviceConversion']

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'
end

s.subspec 'WithoutAdIdSupport' do |ss|
s.subspec 'GoogleAdsOnDeviceConversion' do |ss|
ss.ios.deployment_target = '12.0'
# TODO Update to 2.0.0
ss.dependency 'GoogleAdsOnDeviceConversion', '1.3.0'
end

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
74 changes: 74 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,24 @@ 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 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(
Expand Down Expand Up @@ -374,6 +388,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",
Expand Down
18 changes: 18 additions & 0 deletions SwiftPM-PlatformExclude/FirebaseAnalyticsCoreWrap/dummy.m
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions SwiftPM-PlatformExclude/FirebaseAnalyticsCoreWrap/include/dummy.h
Original file line number Diff line number Diff line change
@@ -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.
Loading