Skip to content

Commit ef0b4b1

Browse files
authored
Firebase zip contents from FirebaseManifest instead of textproto (#6747)
1 parent 126635d commit ef0b4b1

File tree

17 files changed

+98
-1146
lines changed

17 files changed

+98
-1146
lines changed

ZipBuilder/Package.swift

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,11 @@ let package = Package(
2727
],
2828
dependencies: [
2929
.package(url: "https://github.com/apple/swift-argument-parser", .exact("0.0.1")),
30-
// Keep the generated protos in sync with the version below.
31-
// See https://github.com/firebase/firebase-ios-sdk/tree/master/ZipBuilder#updating-protobuf-generated-swift-files.
32-
.package(url: "https://github.com/apple/swift-protobuf.git", .exact("1.7.0")),
3330
],
3431
targets: [
3532
.target(
3633
name: "ZipBuilder",
37-
dependencies: ["ArgumentParser", "ManifestReader", "Utils"]
34+
dependencies: ["ArgumentParser", "FirebaseManifest", "Utils"]
3835
),
3936
.target(
4037
name: "FirebaseManifest"
@@ -43,16 +40,8 @@ let package = Package(
4340
name: "FirebaseReleaser",
4441
dependencies: ["ArgumentParser", "FirebaseManifest", "Utils"]
4542
),
46-
.target(
47-
name: "ManifestReader",
48-
dependencies: ["SwiftProtobuf"]
49-
),
5043
.target(
5144
name: "Utils"
5245
),
53-
.target(
54-
name: "oss-manifest-generator",
55-
dependencies: ["ArgumentParser", "ManifestReader"]
56-
),
5746
]
5847
)

ZipBuilder/README.md

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Firebase Release Tools
22

3-
This project includes Firebase release tooling including a zip builder, a
4-
Firebase Pod release updater, and a manifest reader.
3+
This project includes Firebase release tooling including a zip builder and a
4+
Firebase release candidate creation tool.
55

66
The tools are designed to fail fast with an explanation of what went wrong, so
77
you can fix issues or dig in without having to dig too deep into the code.
@@ -71,58 +71,40 @@ Optional common arguments:
7171
For release engineers (Googlers packaging an upcoming Firebase release) these commands should also be used:
7272
- `-customSpecRepos sso://cpdc-internal/firebase`
7373
- This pulls the latest podspecs from the CocoaPods staging area.
74-
- `-releasingSDKs <PATH_TO_current.textproto>` and
75-
- `-existingVersions <PATH_TO_all_firebase_ios_sdks.textproto>`
76-
- Validates the version numbers fetched from CocoaPods staging against the expected released versions from these
77-
textprotos.
78-
- `-carthageDir <PATH_TO_Firebase/CarthageScripts/json>` Turns on generation of Carthage zips and json file updates.
74+
- `-repoDir path` GitHub repo containing Template and Carthage json file inputs.
75+
- `-carthageBuild true` Turns on generation of Carthage zips and json file updates.
7976
- `-keepBuildArtifacts true` Useful for debugging and verifying the zip build contents.
8077

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

8380
```
84-
swift run ReleasePackager -templateDir $(pwd)/Template -updatePodRepo false \
85-
-releasingSDKs <PATH_TO_current.textproto> \
86-
-existingVersions <PATH_TO_all_firebase_ios_sdks.textproto> \
81+
swift run ReleasePackager -updatePodRepo true \
82+
-repoDir <PATH_TO_current.firebase_ios_sdk.repo> \
8783
-customSpecRepos sso://cpdc-internal/firebase
88-
-carthageDir <PATH_TO_Firebase/CarthageScripts/json>
84+
-carthageBuild true
8985
-keepBuildArtifacts true
9086
```
9187

9288
### Carthage
9389

94-
Carthage binaries can also be built at the same time as the zip file by passing in `-carthageDir
95-
<path_to_json_files>` as a command line argument. This directory should contain JSON files describing versions
90+
Carthage binaries can also be built at the same time as the zip file by passing in `-carthageBuild
91+
true` as a command line argument. This directory should contain JSON files describing versions
9692
and download locations for each product. This will result in a folder called "carthage" at the root where the zip
9793
directory exists containing all the zip files and JSON files necessary for distribution.
9894

99-
## Firebase Pod Updater
95+
## Firebase Releaser
10096

101-
Updates the Firebase pod based on the release proto.
102-
103-
Run with the following two required options like:
104-
105-
- -releasingPods /path/to/M57.textproto
106-
- -gitRoot /path/to/firebase-ios-sdk
107-
108-
### Running the Tool
109-
110-
You can run the tool with `swift run UpdateFirebasePod [ARGS]` or generate an
111-
Xcode project with `swift package generate-xcodeproj` and run within Xcode.
97+
Provides several functions for staging a Firebase release candidate. See the internal go/firi link
98+
for the process documentation.
11299

113100
### Launch Arguments
114101

115102
See `main.swift` and the `LaunchArgs` struct for information on specific launch arguments.
116103

117-
You can pass in launch arguments with Xcode by clicking "UpdateFirebasePod"
104+
You can pass in launch arguments with Xcode by selecting the "firebase-releaser" scheme
118105
beside the Run/Stop buttons, clicking "Edit
119106
Scheme" and adding them in the "Arguments Passed On Launch" section.
120107

121-
## Development and Debugging
122-
123-
You can generate an Xcode project for the tool by running `swift package generate-xcodeproj` in this directory.
124-
See the above instructions for adding Launch Arguments to the Xcode build.
125-
126108
## Development Philosophy
127109

128110
The following section describes the priorities taken while building this tool and should be followed
@@ -168,7 +150,3 @@ files and folders.
168150
### Prefer File `URL`s over Strings
169151
Instead of relying on `String`s to represent file paths, use `URL`s as soon as possible to avoid any
170152
missed or double slashes along with other issues.
171-
172-
## Updating protobuf generated Swift files
173-
- Install [Swift Protobuf](https://github.com/apple/swift-protobuf#building-and-installing-the-code-generator-plugin)
174-
- Run `protoc Sources/ManifestReader/*.proto --swift_opt=Visibility=Public --swift_out=./`

ZipBuilder/Sources/FirebaseManifest/FirebaseManifest.swift

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,35 @@ public let shared = Manifest(
3030
Pod("FirebaseInstallations"),
3131
Pod("FirebaseInstanceID"),
3232
Pod("GoogleAppMeasurement", isClosedSource: true),
33-
Pod("FirebaseAnalytics", isClosedSource: true),
34-
Pod("FirebaseABTesting"),
35-
Pod("FirebaseAppDistribution", isBeta: true),
36-
Pod("FirebaseAuth"),
37-
Pod("FirebaseCrashlytics"),
38-
Pod("FirebaseDatabase"),
39-
Pod("FirebaseDynamicLinks"),
40-
Pod("FirebaseFirestore", allowWarnings: true),
33+
Pod("FirebaseAnalytics", isClosedSource: true, zip: true),
34+
Pod("FirebaseABTesting", zip: true),
35+
Pod("FirebaseAppDistribution", isBeta: true, zip: true),
36+
Pod("FirebaseAuth", zip: true),
37+
Pod("FirebaseCrashlytics", zip: true),
38+
Pod("FirebaseDatabase", zip: true),
39+
Pod("FirebaseDynamicLinks", zip: true),
40+
Pod("FirebaseFirestore", allowWarnings: true, zip: true),
4141
Pod("FirebaseFirestoreSwift", isBeta: true),
42-
Pod("FirebaseFunctions"),
43-
Pod("FirebaseInAppMessaging", isBeta: true),
44-
Pod("FirebaseMessaging"),
45-
Pod("FirebasePerformance", isClosedSource: true),
46-
Pod("FirebaseRemoteConfig"),
47-
Pod("FirebaseStorage"),
42+
Pod("FirebaseFunctions", zip: true),
43+
Pod("FirebaseInAppMessaging", isBeta: true, zip: true),
44+
Pod("FirebaseMessaging", zip: true),
45+
Pod("FirebasePerformance", isClosedSource: true, zip: true),
46+
Pod("FirebaseRemoteConfig", zip: true),
47+
Pod("FirebaseStorage", zip: true),
4848
Pod("FirebaseStorageSwift", isBeta: true),
4949
Pod("FirebaseMLCommon", isClosedSource: true, isBeta: true),
50-
Pod("FirebaseMLModelInterpreter", isClosedSource: true, isBeta: true),
51-
Pod("FirebaseMLVision", isClosedSource: true, isBeta: true),
52-
Pod("Firebase", allowWarnings: true),
50+
Pod("FirebaseMLModelInterpreter", isClosedSource: true, isBeta: true, zip: true),
51+
Pod("FirebaseMLVision", isClosedSource: true, isBeta: true, zip: true),
52+
Pod("Firebase", allowWarnings: true, zip: true),
5353
]
5454
)
5555

5656
/// Manifest describing the contents of a Firebase release.
5757
public struct Manifest {
5858
public let version: String
5959
public let pods: [Pod]
60+
61+
public func versionString(_ pod: Pod) -> String {
62+
return pod.podVersion ?? (pod.isBeta ? version + "-beta" : version)
63+
}
6064
}

ZipBuilder/Sources/FirebaseManifest/Pod.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,24 @@ public struct Pod {
2525
public let allowWarnings: Bool // Allow validation warnings. Ideally these should all be false
2626
public let podVersion: String? // Non-Firebase pods have their own version
2727
public let releasing: Bool // Non-Firebase pods may not release
28+
public let zip: Bool // Top level pod in Zip Distribution
2829

2930
init(_ name: String,
3031
isClosedSource: Bool = false,
3132
isBeta: Bool = false,
3233
isFirebase: Bool = true,
3334
allowWarnings: Bool = false,
3435
podVersion: String? = nil,
35-
releasing: Bool = true) {
36+
releasing: Bool = true,
37+
zip: Bool = false) {
3638
self.name = name
3739
self.isClosedSource = isClosedSource
3840
self.isBeta = isBeta
3941
self.isFirebase = isFirebase
4042
self.allowWarnings = allowWarnings
4143
self.podVersion = podVersion
4244
self.releasing = releasing
45+
self.zip = zip
4346
}
4447

4548
public func podspecName() -> String {

ZipBuilder/Sources/FirebaseReleaser/InitializeRelease.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ struct InitializeRelease {
4747
if pod.name == "Firebase" {
4848
updateFirebasePodspec(path: path, manifest: manifest)
4949
} else {
50-
let version = pod.podVersion ??
51-
(pod.isBeta ? manifest.version + "-beta" : manifest.version)
50+
let version = manifest.versionString(pod)
5251

5352
// Patch the new version to the podspec's version attribute.
5453
Shell.executeCommand("sed -i.bak -e \"s/\\(\\.version.*=[[:space:]]*'\\).*'/\\1" +

0 commit comments

Comments
 (0)