Skip to content

Commit 2f28cdf

Browse files
authored
Add ZipBuilder support for tvOS and macOS (#7212)
1 parent 3116671 commit 2f28cdf

File tree

12 files changed

+445
-384
lines changed

12 files changed

+445
-384
lines changed

.github/workflows/zip.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
quickstart_framework_abtesting:
4848
# Don't run on private repo.
49-
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
49+
# if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
5050
needs: package
5151
env:
5252
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -91,7 +91,7 @@ jobs:
9191

9292
quickstart_framework_auth:
9393
# Don't run on private repo.
94-
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
94+
## if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
9595
needs: package
9696
env:
9797
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -135,7 +135,7 @@ jobs:
135135

136136
quickstart_framework_config:
137137
# Don't run on private repo.
138-
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
138+
## if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
139139
needs: package
140140
env:
141141
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -176,7 +176,7 @@ jobs:
176176

177177
quickstart_framework_crashlytics:
178178
# Don't run on private repo.
179-
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
179+
## if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
180180
needs: package
181181
env:
182182
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -226,7 +226,7 @@ jobs:
226226

227227
quickstart_framework_database:
228228
# Don't run on private repo.
229-
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
229+
## if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
230230
needs: package
231231
env:
232232
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -271,7 +271,7 @@ jobs:
271271

272272
quickstart_framework_dynamiclinks:
273273
# Don't run on private repo.
274-
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
274+
## if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
275275
needs: package
276276
env:
277277
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -321,7 +321,7 @@ jobs:
321321

322322
quickstart_framework_firestore:
323323
# Don't run on private repo.
324-
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
324+
## if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
325325
needs: package
326326
env:
327327
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -364,7 +364,7 @@ jobs:
364364

365365
quickstart_framework_inappmessaging:
366366
# Don't run on private repo.
367-
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
367+
## if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
368368
needs: package
369369
env:
370370
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -410,7 +410,7 @@ jobs:
410410

411411
quickstart_framework_messaging:
412412
# Don't run on private repo.
413-
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
413+
## if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
414414
needs: package
415415
env:
416416
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
@@ -455,7 +455,7 @@ jobs:
455455

456456
quickstart_framework_storage:
457457
# Don't run on private repo.
458-
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
458+
## if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
459459
needs: package
460460
env:
461461
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}

ReleaseTooling/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,5 @@ Other optional arguments:
7171
- `--output-dir <output-dir>`
7272
- The directory to copy the built Zip file. If this is not set, the path to the Zip file will
7373
be logged to the console.
74+
- `--keep-build-artifacts`
75+
- Keep the build artifacts.

ReleaseTooling/Sources/FirebaseManifest/FirebaseManifest.swift

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,27 @@ public let shared = Manifest(
3030
Pod("FirebaseCore"),
3131
Pod("FirebaseInstallations"),
3232
Pod("FirebaseInstanceID"),
33-
Pod("GoogleAppMeasurement", isClosedSource: true),
34-
Pod("FirebaseAnalytics", isClosedSource: true, zip: true),
33+
Pod("GoogleAppMeasurement", isClosedSource: true, platforms: ["ios"]),
34+
Pod("FirebaseAnalytics", isClosedSource: true, platforms: ["ios"], zip: true),
3535
Pod("FirebaseABTesting", zip: true),
3636
Pod("FirebaseRemoteConfig", zip: true),
37-
Pod("FirebaseAppDistribution", isBeta: true, zip: true),
37+
Pod("FirebaseAppDistribution", isBeta: true, platforms: ["ios"], zip: true),
3838
Pod("FirebaseAuth", zip: true),
3939
Pod("FirebaseCrashlytics", zip: true),
4040
Pod("FirebaseDatabase", zip: true),
41-
Pod("FirebaseDynamicLinks", zip: true),
41+
Pod("FirebaseDynamicLinks", platforms: ["ios"], zip: true),
4242
Pod("FirebaseFirestore", allowWarnings: true, zip: true),
4343
Pod("FirebaseFirestoreSwift", isBeta: true),
4444
Pod("FirebaseFunctions", zip: true),
45-
Pod("FirebaseInAppMessaging", isBeta: true, zip: true),
45+
Pod("FirebaseInAppMessaging", isBeta: true, platforms: ["ios"], zip: true),
4646
Pod("FirebaseMessaging", zip: true),
47-
Pod("FirebasePerformance", zip: true),
47+
Pod("FirebasePerformance", platforms: ["ios"], zip: true),
4848
Pod("FirebaseStorage", zip: true),
4949
Pod("FirebaseStorageSwift", isBeta: true),
50-
Pod("FirebaseMLCommon", isClosedSource: true, isBeta: true),
51-
Pod("FirebaseMLModelInterpreter", isClosedSource: true, isBeta: true, zip: true),
52-
Pod("FirebaseMLVision", isClosedSource: true, isBeta: true, zip: true),
50+
Pod("FirebaseMLCommon", isClosedSource: true, isBeta: true, platforms: ["ios"]),
51+
Pod("FirebaseMLModelInterpreter", isClosedSource: true, isBeta: true, platforms: ["ios"],
52+
zip: true),
53+
Pod("FirebaseMLVision", isClosedSource: true, isBeta: true, platforms: ["ios"], zip: true),
5354
Pod("Firebase", allowWarnings: true, zip: true),
5455
]
5556
)

ReleaseTooling/Sources/FirebaseManifest/Pod.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public struct Pod {
2323
public let isBeta: Bool
2424
public let isFirebase: Bool
2525
public let allowWarnings: Bool // Allow validation warnings. Ideally these should all be false
26+
public let platforms: Set<String> // Set of platforms to build this pod for
2627
public let podVersion: String? // Non-Firebase pods have their own version
2728
public let releasing: Bool // Non-Firebase pods may not release
2829
public let zip: Bool // Top level pod in Zip Distribution
@@ -32,6 +33,7 @@ public struct Pod {
3233
isBeta: Bool = false,
3334
isFirebase: Bool = true,
3435
allowWarnings: Bool = false,
36+
platforms: Set<String> = ["ios", "macos", "tvos"],
3537
podVersion: String? = nil,
3638
releasing: Bool = true,
3739
zip: Bool = false) {
@@ -40,6 +42,7 @@ public struct Pod {
4042
self.isBeta = isBeta
4143
self.isFirebase = isFirebase
4244
self.allowWarnings = allowWarnings
45+
self.platforms = platforms
4346
self.podVersion = podVersion
4447
self.releasing = releasing
4548
self.zip = zip

ReleaseTooling/Sources/ZipBuilder/CocoaPodUtils.swift

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,40 @@ enum CocoaPodUtils {
3636

3737
// MARK: - Public API
3838

39-
struct VersionedPod: Decodable, CustomDebugStringConvertible {
39+
// Codable is required because Decodable does not make CodingKeys available.
40+
struct VersionedPod: Codable, CustomDebugStringConvertible {
4041
/// Public name of the pod.
4142
let name: String
4243

4344
/// The version of the requested pod.
4445
let version: String?
4546

47+
/// Platforms supported
48+
let platforms: Set<String>
49+
50+
init(name: String,
51+
version: String?,
52+
platforms: Set<String> = ["ios", "macos", "tvos"]) {
53+
self.name = name
54+
self.version = version
55+
self.platforms = platforms
56+
}
57+
58+
init(from decoder: Decoder) throws {
59+
let container = try decoder.container(keyedBy: CodingKeys.self)
60+
name = try container.decode(String.self, forKey: .name)
61+
if let platforms = try container.decodeIfPresent(Set<String>.self, forKey: .platforms) {
62+
self.platforms = platforms
63+
} else {
64+
platforms = ["ios", "macos", "tvos"]
65+
}
66+
if let version = try container.decodeIfPresent(String.self, forKey: .version) {
67+
self.version = version
68+
} else {
69+
version = nil
70+
}
71+
}
72+
4673
/// The debug description as required by `CustomDebugStringConvertible`.
4774
var debugDescription: String {
4875
var desc = name
@@ -141,7 +168,7 @@ enum CocoaPodUtils {
141168
/// - Parameters:
142169
/// - pods: List of VersionedPods to install
143170
/// - directory: Destination directory for the pods.
144-
/// - minimumIOSVersion: The minimum iOS version as a string. Ex. `10.0`.
171+
/// - platform: Install for one platform at a time.
145172
/// - customSpecRepos: Additional spec repos to check for installation.
146173
/// - linkage: Specifies the linkage type. When `forcedStatic` is used, for the module map
147174
/// construction, we want pod names not module names in the generated OTHER_LD_FLAGS
@@ -150,7 +177,7 @@ enum CocoaPodUtils {
150177
@discardableResult
151178
static func installPods(_ pods: [VersionedPod],
152179
inDir directory: URL,
153-
minimumIOSVersion: String,
180+
platform: Platform,
154181
customSpecRepos: [URL]?,
155182
localPodspecPath: URL?,
156183
linkage: LinkageType) -> [String: PodInfo] {
@@ -171,7 +198,7 @@ enum CocoaPodUtils {
171198
try writePodfile(for: pods,
172199
toDirectory: directory,
173200
customSpecRepos: customSpecRepos,
174-
minimumIOSVersion: minimumIOSVersion,
201+
platform: platform,
175202
localPodspecPath: localPodspecPath,
176203
linkage: linkage)
177204
} catch let FileManager.FileError.directoryNotFound(path) {
@@ -300,7 +327,7 @@ enum CocoaPodUtils {
300327
}
301328
}
302329

303-
static func podInstallPrepare(inProjectDir projectDir: URL, paths: ZipBuilder.FilesystemPaths) {
330+
static func podInstallPrepare(inProjectDir projectDir: URL, templateDir: URL) {
304331
do {
305332
// Create the directory and all intermediate directories.
306333
try FileManager.default.createDirectory(at: projectDir, withIntermediateDirectories: true)
@@ -310,7 +337,7 @@ enum CocoaPodUtils {
310337
}
311338
// Copy the Xcode project needed in order to be able to install Pods there.
312339
let templateFiles = Constants.ProjectPath.requiredFilesForBuilding.map {
313-
paths.templateDir.appendingPathComponent($0)
340+
templateDir.appendingPathComponent($0)
314341
}
315342
for file in templateFiles {
316343
// Each file should be copied to the temporary project directory with the same name.
@@ -414,7 +441,7 @@ enum CocoaPodUtils {
414441
/// is not empty.
415442
private static func generatePodfile(for pods: [VersionedPod],
416443
customSpecsRepos: [URL]?,
417-
minimumIOSVersion: String,
444+
platform: Platform,
418445
localPodspecPath: URL?,
419446
linkage: LinkageType) -> String {
420447
// Start assembling the Podfile.
@@ -440,9 +467,9 @@ enum CocoaPodUtils {
440467
podfile += " use_frameworks! :linkage => :static\n"
441468
}
442469

443-
// Include the minimum iOS version.
470+
// Include the platform and its minimum version.
444471
podfile += """
445-
platform :ios, '\(minimumIOSVersion)'
472+
platform :\(platform.name), '\(platform.minimumVersion)'
446473
target 'FrameworkMaker' do\n
447474
"""
448475

@@ -504,7 +531,7 @@ enum CocoaPodUtils {
504531
private static func writePodfile(for pods: [VersionedPod],
505532
toDirectory directory: URL,
506533
customSpecRepos: [URL]?,
507-
minimumIOSVersion: String,
534+
platform: Platform,
508535
localPodspecPath: URL?,
509536
linkage: LinkageType) throws {
510537
guard FileManager.default.directoryExists(at: directory) else {
@@ -516,7 +543,7 @@ enum CocoaPodUtils {
516543
let path = directory.appendingPathComponent("Podfile")
517544
let podfile = generatePodfile(for: pods,
518545
customSpecsRepos: customSpecRepos,
519-
minimumIOSVersion: minimumIOSVersion,
546+
platform: platform,
520547
localPodspecPath: localPodspecPath,
521548
linkage: linkage)
522549
do {

ReleaseTooling/Sources/ZipBuilder/FirebaseBuilder.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ struct FirebaseBuilder {
3030

3131
/// Wrapper around a generic zip builder that adds in Firebase specific steps including a
3232
/// multi-level zip file, a README, and optionally Carthage artifacts.
33-
func build(in projectDir: URL,
34-
minimumIOSVersion: String,
33+
func build(templateDir: URL,
3534
carthageBuildOptions: CarthageBuildOptions?) {
3635
// Build the zip file and get the path.
3736
do {
38-
let artifacts = try zipBuilder.buildAndAssembleFirebaseRelease(inProjectDir: projectDir,
39-
minimumIOSVersion: minimumIOSVersion,
37+
let artifacts = try zipBuilder.buildAndAssembleFirebaseRelease(templateDir: templateDir,
4038
includeCarthage: carthageBuildOptions !=
4139
nil)
4240
let firebaseVersion = artifacts.firebaseVersion

0 commit comments

Comments
 (0)