Skip to content

Commit 4311d29

Browse files
authored
Always build Carthage with Firebase zip distributions (#8098)
1 parent f920f2f commit 4311d29

File tree

5 files changed

+25
-48
lines changed

5 files changed

+25
-48
lines changed

ReleaseTooling/DEVELOP.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,21 @@ For release engineers (Googlers packaging an upcoming Firebase release) these co
1818
be used:
1919
- `--custom-spec-repos https://github.com/firebase/SpecsStaging.git`
2020
- This pulls the latest podspecs from the CocoaPods staging area.
21-
- `--enable-carthage-build` Turns on generation of Carthage zips and json file updates.
2221
- `--keep-build-artifacts` Useful for debugging and verifying the zip build contents.
2322

2423
Putting them all together, here's a common command to build a releaseable Zip file:
2524

2625
```
2726
swift run zip-builder --update-pod-repo \
2827
--custom-spec-repos https://github.com/firebase/SpecsStaging.git \
29-
--enable-carthage-build \
3028
--keep-build-artifacts
3129
```
3230

3331
#### Carthage
3432

35-
Carthage binaries can also be built at the same time as the zip file by passing in `--enable-carthage-build`
36-
as a command line argument. This directory should contain JSON files describing versions and download
37-
locations for each product. This will result in a folder called "carthage" at the root where the zip directory exists
33+
Carthage binaries can also be built at the same time as the zip file. This directory should contain
34+
JSON files describing versions and download locations for each product. This will result in a folder
35+
called "carthage" at the root where the zip directory exists
3836
containing all the zip files and JSON files necessary for distribution.
3937

4038
## Firebase Releaser

ReleaseTooling/Sources/ZipBuilder/FirebaseBuilder.swift

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,20 @@ struct FirebaseBuilder {
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.
3333
func build(templateDir: URL,
34-
carthageBuildOptions: CarthageBuildOptions?) {
34+
carthageBuildOptions: CarthageBuildOptions) {
3535
// Build the zip file and get the path.
3636
do {
37-
let artifacts = try zipBuilder.buildAndAssembleFirebaseRelease(templateDir: templateDir,
38-
includeCarthage: carthageBuildOptions !=
39-
nil)
37+
let artifacts = try zipBuilder.buildAndAssembleFirebaseRelease(templateDir: templateDir)
4038
let firebaseVersion = artifacts.firebaseVersion
4139
let location = artifacts.zipDir
4240
print("Firebase \(firebaseVersion) directory is ready to be packaged: \(location)")
4341

4442
// Package carthage if it's enabled.
45-
var carthageRoot: URL?
46-
if let carthageBuildOptions = carthageBuildOptions {
47-
carthageRoot = CarthageUtils.packageCarthageRelease(
48-
templateDir: zipBuilder.paths.templateDir,
49-
artifacts: artifacts,
50-
options: carthageBuildOptions
51-
)
52-
}
43+
let carthageRoot = CarthageUtils.packageCarthageRelease(
44+
templateDir: zipBuilder.paths.templateDir,
45+
artifacts: artifacts,
46+
options: carthageBuildOptions
47+
)
5348

5449
// Prepare the release directory for zip packaging.
5550
do {

ReleaseTooling/Sources/ZipBuilder/ZipBuilder.swift

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ struct ZipBuilder {
162162
/// - Parameter podsToInstall: All pods to install.
163163
/// - Returns: Arrays of pod install info and the frameworks installed.
164164
func buildAndAssembleZip(podsToInstall: [CocoaPodUtils.VersionedPod],
165-
includeDependencies: Bool,
166-
includeCarthage: Bool = false) ->
165+
includeDependencies: Bool) ->
167166
([String: CocoaPodUtils.PodInfo], [String: [URL]], URL) {
168167
// Remove CocoaPods cache so the build gets updates after a version is rebuilt during the
169168
// release process. Always do this, since it can be the source of subtle failures on rebuilds.
@@ -304,10 +303,8 @@ struct ZipBuilder {
304303
/// encounters an error, or will quit due to a fatal error with the appropriate log.
305304
///
306305
/// - Parameter templateDir: The template project for pod install.
307-
/// - Parameter includeCarthage: Whether to build and package Carthage.
308306
/// - Throws: One of many errors that could have happened during the build phase.
309-
func buildAndAssembleFirebaseRelease(templateDir: URL,
310-
includeCarthage: Bool) throws -> ReleaseArtifacts {
307+
func buildAndAssembleFirebaseRelease(templateDir: URL) throws -> ReleaseArtifacts {
311308
let manifest = FirebaseManifest.shared
312309
var podsToInstall = manifest.pods.filter { $0.zip }.map {
313310
CocoaPodUtils.VersionedPod(name: $0.name,
@@ -330,8 +327,7 @@ struct ZipBuilder {
330327
let (installedPods, frameworks, carthageCoreDiagnosticsXcframework) =
331328
buildAndAssembleZip(podsToInstall: podsToInstall,
332329
// Always include dependencies for Firebase zips.
333-
includeDependencies: true,
334-
includeCarthage: includeCarthage)
330+
includeDependencies: true)
335331

336332
// We need the Firebase pod to get the version for Carthage and to copy the `Firebase.h` and
337333
// `module.modulemap` file from it.
@@ -345,17 +341,14 @@ struct ZipBuilder {
345341
installedPods: installedPods,
346342
frameworksToAssemble: frameworks,
347343
firebasePod: firebasePod)
348-
var carthageDir: URL?
349-
if includeCarthage {
350-
// Replace Core Diagnostics
351-
var carthageFrameworks = frameworks
352-
carthageFrameworks["FirebaseCoreDiagnostics"] = [carthageCoreDiagnosticsXcframework]
353-
carthageDir = try assembleDistributions(withPackageKind: "CarthageFirebase",
354-
podsToInstall: podsToInstall,
355-
installedPods: installedPods,
356-
frameworksToAssemble: carthageFrameworks,
357-
firebasePod: firebasePod)
358-
}
344+
// Replace Core Diagnostics
345+
var carthageFrameworks = frameworks
346+
carthageFrameworks["FirebaseCoreDiagnostics"] = [carthageCoreDiagnosticsXcframework]
347+
let carthageDir = try assembleDistributions(withPackageKind: "CarthageFirebase",
348+
podsToInstall: podsToInstall,
349+
installedPods: installedPods,
350+
frameworksToAssemble: carthageFrameworks,
351+
firebasePod: firebasePod)
359352

360353
return ReleaseArtifacts(firebaseVersion: firebasePod.version,
361354
zipDir: zipDir, carthageDir: carthageDir)

ReleaseTooling/Sources/ZipBuilder/main.swift

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ struct ZipBuilderTool: ParsableCommand {
5353
help: ArgumentHelp("Whether or not to build dependencies of requested pods."))
5454
var buildDependencies: Bool
5555

56-
/// Flag to also build Carthage artifacts.
57-
@Flag(default: false,
58-
inversion: .prefixedEnableDisable,
59-
help: ArgumentHelp("A flag specifying to build Carthage artifacts."))
60-
var carthageBuild: Bool
61-
6256
/// Flag to enable or disable Carthage version checks. Skipping the check can speed up dev
6357
/// iterations.
6458
@Flag(default: true,
@@ -306,12 +300,9 @@ struct ZipBuilderTool: ParsableCommand {
306300
// pod's podspec options.
307301
PlatformMinimum.useRecentVersions()
308302

309-
var carthageOptions: CarthageBuildOptions?
310-
if carthageBuild {
311-
let jsonDir = paths.repoDir.appendingPathComponents(["ReleaseTooling", "CarthageJSON"])
312-
carthageOptions = CarthageBuildOptions(jsonDir: jsonDir,
313-
isVersionCheckEnabled: carthageVersionCheck)
314-
}
303+
let jsonDir = paths.repoDir.appendingPathComponents(["ReleaseTooling", "CarthageJSON"])
304+
let carthageOptions = CarthageBuildOptions(jsonDir: jsonDir,
305+
isVersionCheckEnabled: carthageVersionCheck)
315306

316307
FirebaseBuilder(zipBuilder: builder).build(templateDir: paths.templateDir,
317308
carthageBuildOptions: carthageOptions)

scripts/build_zip.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ read -a specrepo <<< "${CUSTOM_SPEC_REPOS}"
3535
cd ReleaseTooling
3636
swift run zip-builder --keep-build-artifacts --update-pod-repo \
3737
--local-podspec-path "${REPO}" \
38-
--enable-carthage-build --output-dir "${OUTPUT_DIR}" \
38+
--output-dir "${OUTPUT_DIR}" \
3939
--custom-spec-repos "${specrepo[@]}"

0 commit comments

Comments
 (0)