Skip to content

Commit 7455479

Browse files
feat: add basic support to build frameworks and zip them for the Apple Watch (#12624)
1 parent 3cc143b commit 7455479

File tree

7 files changed

+36
-13
lines changed

7 files changed

+36
-13
lines changed

ReleaseTooling/Sources/FirebaseManifest/FirebaseManifest.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,27 @@ public let shared = Manifest(
3333
Pod("FirebaseInstallations"),
3434
Pod("FirebaseSessions"),
3535
Pod("FirebaseRemoteConfigInterop"),
36-
Pod("GoogleAppMeasurement", isClosedSource: true),
36+
Pod("GoogleAppMeasurement", isClosedSource: true, platforms: ["ios", "macos", "tvos"]),
3737
Pod("GoogleAppMeasurementOnDeviceConversion", isClosedSource: true, platforms: ["ios"]),
38-
Pod("FirebaseAnalytics", isClosedSource: true, zip: true),
38+
Pod("FirebaseAnalytics", isClosedSource: true, platforms: ["ios", "macos", "tvos"], zip: true),
3939
Pod("FirebaseAnalyticsOnDeviceConversion", platforms: ["ios"], zip: true),
4040
Pod("FirebaseABTesting", zip: true),
4141
Pod("FirebaseAppCheck", zip: true),
4242
Pod("FirebaseRemoteConfig", zip: true),
4343
Pod("FirebaseAppDistribution", isBeta: true, platforms: ["ios"], zip: true),
4444
Pod("FirebaseAuth", zip: true),
4545
Pod("FirebaseCrashlytics", zip: true),
46-
Pod("FirebaseDatabase", zip: true),
46+
Pod("FirebaseDatabase", platforms: ["ios", "macos", "tvos"], zip: true),
4747
Pod("FirebaseDynamicLinks", platforms: ["ios"], zip: true),
48-
Pod("FirebaseFirestoreInternal", allowWarnings: true),
49-
Pod("FirebaseFirestore", allowWarnings: true, zip: true),
48+
Pod("FirebaseFirestoreInternal", allowWarnings: true, platforms: ["ios", "macos", "tvos"]),
49+
Pod("FirebaseFirestore", allowWarnings: true, platforms: ["ios", "macos", "tvos"], zip: true),
5050
Pod("FirebaseFunctions", zip: true),
5151
Pod("FirebaseInAppMessaging", isBeta: true, platforms: ["ios"], zip: true),
5252
Pod("FirebaseMessaging", zip: true),
5353
Pod("FirebasePerformance", platforms: ["ios", "tvos"], zip: true),
5454
Pod("FirebaseStorage", zip: true),
5555
Pod("FirebaseMLModelDownloader", isBeta: true, zip: true),
56-
Pod("Firebase", allowWarnings: true, zip: true),
56+
Pod("Firebase", allowWarnings: true, platforms: ["ios", "tvos", "macos"], zip: true),
5757
]
5858
)
5959

ReleaseTooling/Sources/FirebaseManifest/Pod.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public struct Pod {
2626
public let isBeta: Bool
2727
/// Allow validation warnings. Ideally these should all be `false`.
2828
public let allowWarnings: Bool
29-
/// Set of platforms (e.g. "ios", "macos", or "tvos") to build this pod for.
29+
/// Set of platforms (e.g. "ios", "macos", "tvos", or "watchos") to build this pod for.
3030
public let platforms: Set<String>
3131
/// Whether or not the pod is planned for publicly releasing (as some pods are for
3232
/// internal/testing use).
@@ -38,7 +38,7 @@ public struct Pod {
3838
isClosedSource: Bool = false,
3939
isBeta: Bool = false,
4040
allowWarnings: Bool = false,
41-
platforms: Set<String> = ["ios", "macos", "tvos"],
41+
platforms: Set<String> = ["ios", "macos", "tvos", "watchos"],
4242
podVersion: String? = nil,
4343
releasing: Bool = true,
4444
zip: Bool = false) {

ReleaseTooling/Sources/ZipBuilder/CocoaPodUtils.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ enum CocoaPodUtils {
5050

5151
init(name: String,
5252
version: String?,
53-
platforms: Set<String> = ["ios", "macos", "tvos"]) {
53+
platforms: Set<String> = ["ios", "macos", "tvos", "watchos"]) {
5454
self.name = name
5555
self.version = version
5656
self.platforms = platforms
@@ -62,7 +62,7 @@ enum CocoaPodUtils {
6262
if let platforms = try container.decodeIfPresent(Set<String>.self, forKey: .platforms) {
6363
self.platforms = platforms
6464
} else {
65-
platforms = ["ios", "macos", "tvos"]
65+
platforms = ["ios", "macos", "tvos", "watchos"]
6666
}
6767
if let version = try container.decodeIfPresent(String.self, forKey: .version) {
6868
self.version = version

ReleaseTooling/Sources/ZipBuilder/Platform.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ enum Platform: CaseIterable {
2121
case iOS
2222
case macOS
2323
case tvOS
24+
case watchOS
2425

2526
var platformTargets: [TargetPlatform] {
2627
switch self {
2728
case .iOS: return [.iOSDevice, .iOSSimulator] + (SkipCatalyst.skip ? [] : [.catalyst])
2829
case .macOS: return [.macOS]
2930
case .tvOS: return [.tvOSDevice, .tvOSSimulator]
31+
case .watchOS: return [.watchOSDevice, .watchOSSimulator]
3032
}
3133
}
3234

@@ -36,6 +38,7 @@ enum Platform: CaseIterable {
3638
case .iOS: return "ios"
3739
case .macOS: return "macos"
3840
case .tvOS: return "tvos"
41+
case .watchOS: return "watchos"
3942
}
4043
}
4144

@@ -45,6 +48,7 @@ enum Platform: CaseIterable {
4548
case .iOS: return PlatformMinimum.minimumIOSVersion
4649
case .macOS: return PlatformMinimum.minimumMacOSVersion
4750
case .tvOS: return PlatformMinimum.minimumTVOSVersion
51+
case .watchOS: return PlatformMinimum.minimumWatchOSVersion
4852
}
4953
}
5054
}
@@ -53,10 +57,12 @@ enum PlatformMinimum {
5357
fileprivate static var minimumIOSVersion = ""
5458
fileprivate static var minimumMacOSVersion = ""
5559
fileprivate static var minimumTVOSVersion = ""
56-
static func initialize(ios: String, macos: String, tvos: String) {
60+
fileprivate static var minimumWatchOSVersion = ""
61+
static func initialize(ios: String, macos: String, tvos: String, watchos: String) {
5762
minimumIOSVersion = ios
5863
minimumMacOSVersion = macos
5964
minimumTVOSVersion = tvos
65+
minimumWatchOSVersion = watchos
6066
}
6167

6268
/// Useful to disable minimum version checking on pod installation. Pods still get built with
@@ -65,6 +71,7 @@ enum PlatformMinimum {
6571
minimumIOSVersion = "14.0"
6672
minimumMacOSVersion = "11.0"
6773
minimumTVOSVersion = "14.0"
74+
minimumWatchOSVersion = "8.0"
6875
}
6976
}
7077

ReleaseTooling/Sources/ZipBuilder/TargetPlatform.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ enum TargetPlatform: CaseIterable {
3030
case tvOSDevice
3131
/// Binaries to target tvOS simulators.
3232
case tvOSSimulator
33+
/// Binaries to target tvOS.
34+
case watchOSDevice
35+
/// Binaries to target tvOS simulators.
36+
case watchOSSimulator
3337

3438
/// Valid architectures to be built for the platform.
3539
var archs: [Architecture] {
@@ -43,6 +47,8 @@ enum TargetPlatform: CaseIterable {
4347
case .macOS: return [.x86_64, .arm64]
4448
case .tvOSDevice: return [.arm64]
4549
case .tvOSSimulator: return [.x86_64, .arm64]
50+
case .watchOSDevice: return [.arm64_32, .arm64]
51+
case .watchOSSimulator: return [.x86_64, .arm64]
4652
}
4753
}
4854

@@ -55,6 +61,8 @@ enum TargetPlatform: CaseIterable {
5561
case .macOS: return "macosx"
5662
case .tvOSDevice: return "appletvos"
5763
case .tvOSSimulator: return "appletvsimulator"
64+
case .watchOSDevice: return "watchos"
65+
case .watchOSSimulator: return "watchsimulator"
5866
}
5967
}
6068

@@ -75,13 +83,16 @@ enum TargetPlatform: CaseIterable {
7583
case .macOS: return "Release"
7684
case .tvOSDevice: return "Release-appletvos"
7785
case .tvOSSimulator: return "Release-appletvsimulator"
86+
case .watchOSDevice: return "Release-watchos"
87+
case .watchOSSimulator: return "Release-watchsimulator"
7888
}
7989
}
8090
}
8191

8292
/// Different architectures to build frameworks for.
8393
enum Architecture: String, CaseIterable {
8494
case arm64
95+
case arm64_32
8596
case armv7
8697
case i386
8798
case x86_64

ReleaseTooling/Sources/ZipBuilder/main.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ struct ZipBuilderTool: ParsableCommand {
111111
@Option(default: "12.0", help: ArgumentHelp("The minimum supported tvOS version."))
112112
var minimumTVOSVersion: String
113113

114+
/// The minimum watchOS Version to build for.
115+
@Option(default: "6.0", help: ArgumentHelp("The minimum supported watchOS version."))
116+
var minimumWatchOSVersion: String
117+
114118
/// The list of platforms to build for.
115119
@Option(parsing: .upToNextOption,
116120
help: ArgumentHelp("""
@@ -272,7 +276,8 @@ struct ZipBuilderTool: ParsableCommand {
272276
// Set the platform minimum versions.
273277
PlatformMinimum.initialize(ios: minimumIOSVersion,
274278
macos: minimumMacOSVersion,
275-
tvos: minimumTVOSVersion)
279+
tvos: minimumTVOSVersion,
280+
watchos: minimumWatchOSVersion)
276281

277282
let (installedPods, frameworks, _) =
278283
builder.buildAndAssembleZip(podsToInstall: podsToBuild,

ReleaseTooling/Template/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Firebase Apple SDKs
22

33
This directory contains the full Firebase Apple distribution, packaged as static
4-
xcframeworks that include support for the iOS, tvOS, macOS, and Catalyst
4+
xcframeworks that include support for the iOS, tvOS, macOS, watchOS and Catalyst
55
platforms.
66

77
# Integration Instructions

0 commit comments

Comments
 (0)