Skip to content

[Infra] Bump swift-tools-version in Package.swift #15026

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions FirebaseCore/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
To start using the new SDK, import the `FirebaseAI` module and use the
top-level `FirebaseAI` class. See details in the [migration guide
](https://firebase.google.com/docs/ai-logic/migrate-to-latest-sdk).
- [changed] **Breaking change** The Firebase Swift package now requires the
Swift 6.0 toolchain (Xcode 16.2+).

# Firebase 11.15.0
- [fixed] Remove c99 as the required C language standard. (#14950)
Expand Down
55 changes: 40 additions & 15 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.9
// swift-tools-version:6.0
// The swift-tools-version declares the minimum version of Swift required to
// build this package.

Expand All @@ -16,7 +16,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import class Foundation.ProcessInfo
import PackageDescription

let firebaseVersion = "12.0.0"
Expand Down Expand Up @@ -521,7 +520,9 @@ let package = Package(
"ObjC", "Public",
],
resources: [.process("Resources/PrivacyInfo.xcprivacy")],
swiftSettings: Context.environment["FIREBASE_CI"] != nil ? [.define("FIREBASE_CI")] : [],
swiftSettings: [
.swiftLanguageMode(SwiftLanguageMode.v5),
],
linkerSettings: [
.linkedFramework("Security"),
.linkedFramework("SafariServices", .when(platforms: [.iOS])),
Expand Down Expand Up @@ -572,7 +573,10 @@ let package = Package(
.target(
name: "FirebaseAuthCombineSwift",
dependencies: ["FirebaseAuth"],
path: "FirebaseCombineSwift/Sources/Auth"
path: "FirebaseCombineSwift/Sources/Auth",
swiftSettings: [
.swiftLanguageMode(SwiftLanguageMode.v5),
]
),
.target(
name: "FirebaseFirestoreCombineSwift",
Expand Down Expand Up @@ -799,7 +803,10 @@ let package = Package(
.target(
name: "FirebaseFunctionsCombineSwift",
dependencies: ["FirebaseFunctions"],
path: "FirebaseCombineSwift/Sources/Functions"
path: "FirebaseCombineSwift/Sources/Functions",
swiftSettings: [
.swiftLanguageMode(SwiftLanguageMode.v5),
]
),
.testTarget(
name: "FunctionsCombineUnit",
Expand Down Expand Up @@ -852,7 +859,10 @@ let package = Package(
.target(
name: "FirebaseInAppMessaging",
dependencies: ["FirebaseInAppMessagingInternal"],
path: "FirebaseInAppMessaging/Swift/Source"
path: "FirebaseInAppMessaging/Swift/Source",
swiftSettings: [
.swiftLanguageMode(SwiftLanguageMode.v5),
]
),

.target(
Expand Down Expand Up @@ -890,6 +900,9 @@ let package = Package(
],
cSettings: [
.define("FIRMLModelDownloader_VERSION", to: firebaseVersion),
],
swiftSettings: [
.swiftLanguageMode(SwiftLanguageMode.v5),
]
),
.testTarget(
Expand Down Expand Up @@ -1074,7 +1087,10 @@ let package = Package(
"FirebaseSharedSwift",
],
path: "FirebaseRemoteConfig/Swift",
resources: [.process("Resources/PrivacyInfo.xcprivacy")]
resources: [.process("Resources/PrivacyInfo.xcprivacy")],
swiftSettings: [
.swiftLanguageMode(SwiftLanguageMode.v5),
]
),
.testTarget(
name: "RemoteConfigFakeConsole",
Expand Down Expand Up @@ -1198,7 +1214,10 @@ let package = Package(
.product(name: "GTMSessionFetcherCore", package: "gtm-session-fetcher"),
.product(name: "GULEnvironment", package: "GoogleUtilities"),
],
path: "FirebaseStorage/Sources"
path: "FirebaseStorage/Sources",
swiftSettings: [
.swiftLanguageMode(SwiftLanguageMode.v5),
]
),
.testTarget(
name: "FirebaseStorageUnit",
Expand Down Expand Up @@ -1386,7 +1405,7 @@ func googleAppMeasurementDependency() -> Package.Dependency {

// Point SPM CI to the tip of main of https://github.com/google/GoogleAppMeasurement so that the
// release process can defer publishing the GoogleAppMeasurement tag until after testing.
if ProcessInfo.processInfo.environment["FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT"] != nil {
if Context.environment["FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT"] != nil {
return .package(url: appMeasurementURL, branch: "main")
Copy link
Member Author

@ncooke3 ncooke3 Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated to the Swift tools version bump. This API was added to the PackageDescription module in Swift 5.6, and seems slightly cleaner (e.g. importing ProcessInfo is unneeded).

}

Expand All @@ -1398,7 +1417,7 @@ func abseilDependency() -> Package.Dependency {

// If building Firestore from source, abseil will need to be built as source
// as the headers in the binary version of abseil are unusable.
if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
if Context.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
packageInfo = (
"https://github.com/firebase/abseil-cpp-SwiftPM.git",
"0.20240722.0" ..< "0.20240723.0"
Expand All @@ -1418,7 +1437,7 @@ func grpcDependency() -> Package.Dependency {

// If building Firestore from source, abseil will need to be built as source
// as the headers in the binary version of abseil are unusable.
if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
if Context.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
packageInfo = ("https://github.com/grpc/grpc-ios.git", "1.69.0" ..< "1.70.0")
} else {
packageInfo = ("https://github.com/google/grpc-binary.git", "1.69.0" ..< "1.70.0")
Expand All @@ -1428,7 +1447,7 @@ func grpcDependency() -> Package.Dependency {
}

func firestoreWrapperTarget() -> Target {
if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
if Context.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
return .target(
name: "FirebaseFirestoreTarget",
dependencies: [.target(name: "FirebaseFirestore",
Expand All @@ -1447,7 +1466,7 @@ func firestoreWrapperTarget() -> Target {
}

func firestoreTargets() -> [Target] {
if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
if Context.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
return [
.target(
name: "FirebaseFirestoreInternalWrapper",
Expand Down Expand Up @@ -1543,13 +1562,16 @@ func firestoreTargets() -> [Target] {
sources: [
"Swift/Source/",
],
resources: [.process("Source/Resources/PrivacyInfo.xcprivacy")]
resources: [.process("Source/Resources/PrivacyInfo.xcprivacy")],
swiftSettings: [
.swiftLanguageMode(SwiftLanguageMode.v5),
]
),
]
}

let firestoreInternalTarget: Target = {
if ProcessInfo.processInfo.environment["FIREBASECI_USE_LOCAL_FIRESTORE_ZIP"] != nil {
if Context.environment["FIREBASECI_USE_LOCAL_FIRESTORE_ZIP"] != nil {
// This is set when running `scripts/check_firestore_symbols.sh`.
return .binaryTarget(
name: "FirebaseFirestoreInternal",
Expand Down Expand Up @@ -1592,6 +1614,9 @@ func firestoreTargets() -> [Target] {
],
path: "Firestore/Swift/Source",
resources: [.process("Resources/PrivacyInfo.xcprivacy")],
swiftSettings: [
.swiftLanguageMode(SwiftLanguageMode.v5),
],
linkerSettings: [
.linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
.linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS])),
Expand Down
Loading