Skip to content

Commit

Permalink
feat: add basic support to build frameworks and zip them for the Appl…
Browse files Browse the repository at this point in the history
…e Watch (#12624)
  • Loading branch information
jasesuperhero authored Apr 1, 2024
1 parent 3cc143b commit 7455479
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 13 deletions.
12 changes: 6 additions & 6 deletions ReleaseTooling/Sources/FirebaseManifest/FirebaseManifest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,27 @@ public let shared = Manifest(
Pod("FirebaseInstallations"),
Pod("FirebaseSessions"),
Pod("FirebaseRemoteConfigInterop"),
Pod("GoogleAppMeasurement", isClosedSource: true),
Pod("GoogleAppMeasurement", isClosedSource: true, platforms: ["ios", "macos", "tvos"]),
Pod("GoogleAppMeasurementOnDeviceConversion", isClosedSource: true, platforms: ["ios"]),
Pod("FirebaseAnalytics", isClosedSource: true, zip: true),
Pod("FirebaseAnalytics", isClosedSource: true, platforms: ["ios", "macos", "tvos"], zip: true),
Pod("FirebaseAnalyticsOnDeviceConversion", platforms: ["ios"], zip: true),
Pod("FirebaseABTesting", zip: true),
Pod("FirebaseAppCheck", zip: true),
Pod("FirebaseRemoteConfig", zip: true),
Pod("FirebaseAppDistribution", isBeta: true, platforms: ["ios"], zip: true),
Pod("FirebaseAuth", zip: true),
Pod("FirebaseCrashlytics", zip: true),
Pod("FirebaseDatabase", zip: true),
Pod("FirebaseDatabase", platforms: ["ios", "macos", "tvos"], zip: true),
Pod("FirebaseDynamicLinks", platforms: ["ios"], zip: true),
Pod("FirebaseFirestoreInternal", allowWarnings: true),
Pod("FirebaseFirestore", allowWarnings: true, zip: true),
Pod("FirebaseFirestoreInternal", allowWarnings: true, platforms: ["ios", "macos", "tvos"]),
Pod("FirebaseFirestore", allowWarnings: true, platforms: ["ios", "macos", "tvos"], zip: true),
Pod("FirebaseFunctions", zip: true),
Pod("FirebaseInAppMessaging", isBeta: true, platforms: ["ios"], zip: true),
Pod("FirebaseMessaging", zip: true),
Pod("FirebasePerformance", platforms: ["ios", "tvos"], zip: true),
Pod("FirebaseStorage", zip: true),
Pod("FirebaseMLModelDownloader", isBeta: true, zip: true),
Pod("Firebase", allowWarnings: true, zip: true),
Pod("Firebase", allowWarnings: true, platforms: ["ios", "tvos", "macos"], zip: true),
]
)

Expand Down
4 changes: 2 additions & 2 deletions ReleaseTooling/Sources/FirebaseManifest/Pod.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public struct Pod {
public let isBeta: Bool
/// Allow validation warnings. Ideally these should all be `false`.
public let allowWarnings: Bool
/// Set of platforms (e.g. "ios", "macos", or "tvos") to build this pod for.
/// Set of platforms (e.g. "ios", "macos", "tvos", or "watchos") to build this pod for.
public let platforms: Set<String>
/// Whether or not the pod is planned for publicly releasing (as some pods are for
/// internal/testing use).
Expand All @@ -38,7 +38,7 @@ public struct Pod {
isClosedSource: Bool = false,
isBeta: Bool = false,
allowWarnings: Bool = false,
platforms: Set<String> = ["ios", "macos", "tvos"],
platforms: Set<String> = ["ios", "macos", "tvos", "watchos"],
podVersion: String? = nil,
releasing: Bool = true,
zip: Bool = false) {
Expand Down
4 changes: 2 additions & 2 deletions ReleaseTooling/Sources/ZipBuilder/CocoaPodUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ enum CocoaPodUtils {

init(name: String,
version: String?,
platforms: Set<String> = ["ios", "macos", "tvos"]) {
platforms: Set<String> = ["ios", "macos", "tvos", "watchos"]) {
self.name = name
self.version = version
self.platforms = platforms
Expand All @@ -62,7 +62,7 @@ enum CocoaPodUtils {
if let platforms = try container.decodeIfPresent(Set<String>.self, forKey: .platforms) {
self.platforms = platforms
} else {
platforms = ["ios", "macos", "tvos"]
platforms = ["ios", "macos", "tvos", "watchos"]
}
if let version = try container.decodeIfPresent(String.self, forKey: .version) {
self.version = version
Expand Down
9 changes: 8 additions & 1 deletion ReleaseTooling/Sources/ZipBuilder/Platform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ enum Platform: CaseIterable {
case iOS
case macOS
case tvOS
case watchOS

var platformTargets: [TargetPlatform] {
switch self {
case .iOS: return [.iOSDevice, .iOSSimulator] + (SkipCatalyst.skip ? [] : [.catalyst])
case .macOS: return [.macOS]
case .tvOS: return [.tvOSDevice, .tvOSSimulator]
case .watchOS: return [.watchOSDevice, .watchOSSimulator]
}
}

Expand All @@ -36,6 +38,7 @@ enum Platform: CaseIterable {
case .iOS: return "ios"
case .macOS: return "macos"
case .tvOS: return "tvos"
case .watchOS: return "watchos"
}
}

Expand All @@ -45,6 +48,7 @@ enum Platform: CaseIterable {
case .iOS: return PlatformMinimum.minimumIOSVersion
case .macOS: return PlatformMinimum.minimumMacOSVersion
case .tvOS: return PlatformMinimum.minimumTVOSVersion
case .watchOS: return PlatformMinimum.minimumWatchOSVersion
}
}
}
Expand All @@ -53,10 +57,12 @@ enum PlatformMinimum {
fileprivate static var minimumIOSVersion = ""
fileprivate static var minimumMacOSVersion = ""
fileprivate static var minimumTVOSVersion = ""
static func initialize(ios: String, macos: String, tvos: String) {
fileprivate static var minimumWatchOSVersion = ""
static func initialize(ios: String, macos: String, tvos: String, watchos: String) {
minimumIOSVersion = ios
minimumMacOSVersion = macos
minimumTVOSVersion = tvos
minimumWatchOSVersion = watchos
}

/// Useful to disable minimum version checking on pod installation. Pods still get built with
Expand All @@ -65,6 +71,7 @@ enum PlatformMinimum {
minimumIOSVersion = "14.0"
minimumMacOSVersion = "11.0"
minimumTVOSVersion = "14.0"
minimumWatchOSVersion = "8.0"
}
}

Expand Down
11 changes: 11 additions & 0 deletions ReleaseTooling/Sources/ZipBuilder/TargetPlatform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ enum TargetPlatform: CaseIterable {
case tvOSDevice
/// Binaries to target tvOS simulators.
case tvOSSimulator
/// Binaries to target tvOS.
case watchOSDevice
/// Binaries to target tvOS simulators.
case watchOSSimulator

/// Valid architectures to be built for the platform.
var archs: [Architecture] {
Expand All @@ -43,6 +47,8 @@ enum TargetPlatform: CaseIterable {
case .macOS: return [.x86_64, .arm64]
case .tvOSDevice: return [.arm64]
case .tvOSSimulator: return [.x86_64, .arm64]
case .watchOSDevice: return [.arm64_32, .arm64]
case .watchOSSimulator: return [.x86_64, .arm64]
}
}

Expand All @@ -55,6 +61,8 @@ enum TargetPlatform: CaseIterable {
case .macOS: return "macosx"
case .tvOSDevice: return "appletvos"
case .tvOSSimulator: return "appletvsimulator"
case .watchOSDevice: return "watchos"
case .watchOSSimulator: return "watchsimulator"
}
}

Expand All @@ -75,13 +83,16 @@ enum TargetPlatform: CaseIterable {
case .macOS: return "Release"
case .tvOSDevice: return "Release-appletvos"
case .tvOSSimulator: return "Release-appletvsimulator"
case .watchOSDevice: return "Release-watchos"
case .watchOSSimulator: return "Release-watchsimulator"
}
}
}

/// Different architectures to build frameworks for.
enum Architecture: String, CaseIterable {
case arm64
case arm64_32
case armv7
case i386
case x86_64
Expand Down
7 changes: 6 additions & 1 deletion ReleaseTooling/Sources/ZipBuilder/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ struct ZipBuilderTool: ParsableCommand {
@Option(default: "12.0", help: ArgumentHelp("The minimum supported tvOS version."))
var minimumTVOSVersion: String

/// The minimum watchOS Version to build for.
@Option(default: "6.0", help: ArgumentHelp("The minimum supported watchOS version."))
var minimumWatchOSVersion: String

/// The list of platforms to build for.
@Option(parsing: .upToNextOption,
help: ArgumentHelp("""
Expand Down Expand Up @@ -272,7 +276,8 @@ struct ZipBuilderTool: ParsableCommand {
// Set the platform minimum versions.
PlatformMinimum.initialize(ios: minimumIOSVersion,
macos: minimumMacOSVersion,
tvos: minimumTVOSVersion)
tvos: minimumTVOSVersion,
watchos: minimumWatchOSVersion)

let (installedPods, frameworks, _) =
builder.buildAndAssembleZip(podsToInstall: podsToBuild,
Expand Down
2 changes: 1 addition & 1 deletion ReleaseTooling/Template/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Firebase Apple SDKs

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

# Integration Instructions
Expand Down

0 comments on commit 7455479

Please sign in to comment.