Skip to content
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

[Config] Consolidate Config and ConfigSwift #11808

Merged
merged 20 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f4bdf6b
[Config] Merge RemoteConfig and its Swift extension in a non-breaking…
ncooke3 Aug 24, 2023
a2beb9c
[Config] Refactor Swift sources out of FirebaseRemoteConfigSwift (#11…
ncooke3 Aug 29, 2023
0681681
[Config] Lock down no-op API's availability for Swift clients (#11764)
ncooke3 Aug 31, 2023
e3619bb
[ConfigSwift] Only re-export the API that used to be in ConfigSwift (…
ncooke3 Sep 1, 2023
c410dff
[Config] Update RemoteConfig and RemoteConfigSwift CHANGELOGs (#11749)
ncooke3 Sep 3, 2023
709cdd5
Resolve TODO and stub out warning
ncooke3 Sep 12, 2023
323562a
Update changelog
ncooke3 Sep 12, 2023
3f92582
Add TODO to update changelog entry if warning is enabled
ncooke3 Sep 12, 2023
002c3a6
Minimize dependency versioning in podspec
ncooke3 Sep 12, 2023
f074877
Add note in deprecation warning about '@testable' imports
ncooke3 Sep 13, 2023
204f84a
Add note in release note about '@testable' imports
ncooke3 Sep 13, 2023
5a0f6aa
Update release note to reflect plan to deprecate
ncooke3 Sep 13, 2023
8f45cfb
Enable deprecation warning
ncooke3 Sep 13, 2023
a60c4a1
Update dependency version in podspec
ncooke3 Sep 13, 2023
4ab1dbd
Allow warnings since RCSwift is deprecated
ncooke3 Sep 14, 2023
51ae256
Resolve TODO
ncooke3 Sep 14, 2023
187aaf1
Make warning message a non-multiline string
ncooke3 Sep 14, 2023
14fa489
Fix SPM CI
ncooke3 Sep 14, 2023
5254025
Update deprecation/documentation messages
ncooke3 Oct 10, 2023
382345f
Update dependency version in podspec
ncooke3 Oct 12, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/remoteconfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
strategy:
matrix:
target: [ios, tvos, macos, watchos]
podspec: [FirebaseRemoteConfig.podspec, FirebaseRemoteConfigSwift.podspec --skip-tests]
podspec: [FirebaseRemoteConfig.podspec, FirebaseRemoteConfigSwift.podspec --allow-warnings --skip-tests]
ncooke3 marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
Expand Down
2 changes: 2 additions & 0 deletions FirebaseRemoteConfig.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ app update.
'FirebaseABTesting/Sources/Private/*.h',
'FirebaseCore/Extension/*.h',
'FirebaseInstallations/Source/Library/Private/*.h',
'FirebaseRemoteConfig/Swift/**/*.swift',
]
s.public_header_files = base_dir + 'Public/FirebaseRemoteConfig/*.h'
s.pod_target_xcconfig = {
'GCC_C_LANGUAGE_STANDARD' => 'c99',
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"'
}
s.dependency 'FirebaseABTesting', '~> 10.0'
s.dependency 'FirebaseSharedSwift', '~> 10.0'
s.dependency 'FirebaseCore', '~> 10.0'
s.dependency 'FirebaseInstallations', '~> 10.0'
s.dependency 'GoogleUtilities/Environment', '~> 7.8'
Expand Down
6 changes: 6 additions & 0 deletions FirebaseRemoteConfig/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Unreleased
- [feature] The `FirebaseRemoteConfig` module now contains Firebase Remote
Config's Swift-only APIs that were previously only available via the
`FirebaseRemoteConfigSwift` extension SDK. See the
`FirebaseRemoteConfigSwift` release note from this release for more details.

# 10.12.0
- [fixed] Fix issue of real-time listeners not being properly removed. (#11458)
- [fixed] Fix real-time fetches not being able to fetch the latest template due to an in-progress fetch. (#11465)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/

import Foundation
import FirebaseRemoteConfig
#if SWIFT_PACKAGE
@_exported import FirebaseRemoteConfigInternal
#endif // SWIFT_PACKAGE
import FirebaseSharedSwift

public enum RemoteConfigValueCodableError: Error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/

import Foundation
import FirebaseRemoteConfig
#if SWIFT_PACKAGE
@_exported import FirebaseRemoteConfigInternal
#endif // SWIFT_PACKAGE
import FirebaseSharedSwift

/// Implement the FirebaseRemoteConfigValueDecoding protocol for the shared Firebase decoder to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
* limitations under the License.
*/

import FirebaseRemoteConfig
#if SWIFT_PACKAGE
@_exported import FirebaseRemoteConfigInternal
#endif // SWIFT_PACKAGE

import SwiftUI

/// A property wrapper that listens to a Remote Config value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

import FirebaseRemoteConfig
#if SWIFT_PACKAGE
@_exported import FirebaseRemoteConfigInternal
#endif // SWIFT_PACKAGE
import FirebaseCore
import SwiftUI

Expand Down
30 changes: 30 additions & 0 deletions FirebaseRemoteConfig/Swift/SPMSwiftHeaderWorkaround.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2023 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.

#if SWIFT_PACKAGE
@_exported import FirebaseRemoteConfigInternal

// This is a trick to force generate a `FirebaseRemoteConfig-Swift.h` header
// that re-exports `FirebaseRemoteConfigInternal` for Objective-C clients. It
// is important for the below code to reference a Remote Config symbol defined
// in Objective-C as that will import the symbol's module
// (`FirebaseRemoteConfigInternal`) in the generated header. This allows
// Objective-C clients to import Remote Config's Objective-C API using
// `@import FirebaseRemoteConfig;`. This API is not needed for Swift clients
// and is therefore unavailable in a Swift context.
@available(*, unavailable)
@objc public extension RemoteConfig {
static var __no_op: () -> Void { {} }
}
#endif // SWIFT_PACKAGE
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/

import Foundation
import FirebaseRemoteConfig
#if SWIFT_PACKAGE
@_exported import FirebaseRemoteConfigInternal
#endif // SWIFT_PACKAGE

/// Implements subscript overloads to enable Remote Config values to be accessed
/// in a type-safe way directly from the current config.
Expand Down
3 changes: 1 addition & 2 deletions FirebaseRemoteConfigSwift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ app update.
]

s.dependency 'FirebaseCore', '~> 10.0'
s.dependency 'FirebaseRemoteConfig', '~> 10.0'
s.dependency 'FirebaseSharedSwift', '~> 10.0'
s.dependency 'FirebaseRemoteConfig', '~> 10.17'

# Run Swift API tests on a real backend.
s.test_spec 'swift-api-tests' do |swift_api|
Expand Down
7 changes: 7 additions & 0 deletions FirebaseRemoteConfigSwift/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Unreleased
- [deprecated] All of the public API from `FirebaseRemoteConfigSwift` can now
be accessed through the `FirebaseRemoteConfig` module. Therefore,
`FirebaseRemoteConfigSwift` has been deprecated, and will be removed in a
future release. See https://firebase.google.com/docs/ios/swift-migration for
migration instructions.

# 10.1.0
- [fixed] Fix CocoaPods release did not include the RemoteConfigProperty feature. (#10371)

Expand Down
24 changes: 24 additions & 0 deletions FirebaseRemoteConfigSwift/Sources/FirebaseRemoteConfigSwift.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 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.

#warning(
"All of the public API from `FirebaseRemoteConfigSwift` can now be accessed through the `FirebaseRemoteConfig` module. Therefore, the `FirebaseRemoteConfigSwift` module is deprecated and will be removed in the future. See https://firebase.google.com/docs/ios/swift-migration for migration instructions."
)

// The `@_exported` is needed to prevent breaking clients that are using
// types prefixed with the `FirebaseRemoteConfigSwift` module name (e.g.
// `FirebaseRemoteConfigSwift.RemoteConfigValueCodableError`).
@_exported import enum FirebaseRemoteConfig.RemoteConfigValueCodableError
@_exported import enum FirebaseRemoteConfig.RemoteConfigCodableError
@_exported import struct FirebaseRemoteConfig.RemoteConfigProperty
1 change: 0 additions & 1 deletion FirebaseRemoteConfigSwift/Tests/SwiftAPI/Codable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

import FirebaseRemoteConfig
import FirebaseRemoteConfigSwift

import XCTest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import FirebaseCore
import FirebaseRemoteConfig
import FirebaseRemoteConfigSwift

import XCTest

let ConfigKeyForThisTestOnly = "PropertyWrapperDefaultConfigsTestsKey"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import FirebaseRemoteConfig
import FirebaseRemoteConfigSwift

import XCTest

#if compiler(>=5.5.2) && canImport(_Concurrency)
Expand Down
1 change: 0 additions & 1 deletion FirebaseRemoteConfigSwift/Tests/SwiftAPI/Value.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

import FirebaseRemoteConfig
import FirebaseRemoteConfigSwift

import XCTest

Expand Down
21 changes: 16 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,10 @@ let package = Package(
dependencies: [
"FirebaseCore",
"FirebaseInstallations",
"FirebaseRemoteConfig",
// Performance depends on the Obj-C target of FirebaseRemoteConfig to
ncooke3 marked this conversation as resolved.
Show resolved Hide resolved
// avoid including Swift code from the `FirebaseRemoteConfig` target
// that is unneeded.
"FirebaseRemoteConfigInternal",
"FirebaseSessions",
.product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
.product(name: "GULEnvironment", package: "GoogleUtilities"),
Expand Down Expand Up @@ -958,7 +961,7 @@ let package = Package(
// MARK: - Firebase Remote Config

.target(
name: "FirebaseRemoteConfig",
name: "FirebaseRemoteConfigInternal",
dependencies: [
"FirebaseCore",
"FirebaseABTesting",
Expand All @@ -973,7 +976,7 @@ let package = Package(
),
.testTarget(
name: "RemoteConfigUnit",
dependencies: ["FirebaseRemoteConfig", .product(name: "OCMock", package: "ocmock")],
dependencies: ["FirebaseRemoteConfigInternal", .product(name: "OCMock", package: "ocmock")],
path: "FirebaseRemoteConfig/Tests/Unit",
exclude: [
// Need to be evaluated/ported to RC V2.
Expand All @@ -992,17 +995,25 @@ let package = Package(
.headerSearchPath("../../.."),
]
),
.target(
name: "FirebaseRemoteConfig",
dependencies: [
"FirebaseRemoteConfigInternal",
"FirebaseSharedSwift",
],
path: "FirebaseRemoteConfig/Swift"
),
.target(
name: "FirebaseRemoteConfigSwift",
dependencies: [
"FirebaseRemoteConfig",
"FirebaseSharedSwift",
],
path: "FirebaseRemoteConfigSwift/Sources"
),
.testTarget(
name: "RemoteConfigFakeConsole",
dependencies: ["FirebaseRemoteConfigSwift",
dependencies: ["FirebaseRemoteConfig",
"FirebaseRemoteConfigSwift",
"RemoteConfigFakeConsoleObjC"],
path: "FirebaseRemoteConfigSwift/Tests",
exclude: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public let shared = Manifest(
Pod("FirebaseABTesting", zip: true),
Pod("FirebaseAppCheck", zip: true),
Pod("FirebaseRemoteConfig"),
Pod("FirebaseRemoteConfigSwift", zip: true),
Pod("FirebaseRemoteConfigSwift", allowWarnings: true, zip: true),
Pod("FirebaseAppDistribution", isBeta: true, platforms: ["ios"], zip: true),
Pod("FirebaseAuth", zip: true),
Pod("FirebaseCrashlytics", zip: true),
Expand Down