Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions ZipBuilder/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", .exact("0.0.1")),
// Keep the generated protos in sync with the version below.
// See https://github.com/firebase/firebase-ios-sdk/tree/master/ZipBuilder#updating-protobuf-generated-swift-files.
.package(url: "https://github.com/apple/swift-protobuf.git", .exact("1.7.0")),
],
targets: [
.target(
name: "ZipBuilder",
dependencies: ["ArgumentParser", "ManifestReader", "Utils"]
dependencies: ["ArgumentParser", "FirebaseManifest", "Utils"]
),
.target(
name: "FirebaseManifest"
Expand All @@ -43,16 +40,8 @@ let package = Package(
name: "FirebaseReleaser",
dependencies: ["ArgumentParser", "FirebaseManifest", "Utils"]
),
.target(
name: "ManifestReader",
dependencies: ["SwiftProtobuf"]
),
.target(
name: "Utils"
),
.target(
name: "oss-manifest-generator",
dependencies: ["ArgumentParser", "ManifestReader"]
),
]
)
48 changes: 13 additions & 35 deletions ZipBuilder/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Firebase Release Tools

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

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

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

```
swift run ReleasePackager -templateDir $(pwd)/Template -updatePodRepo false \
-releasingSDKs <PATH_TO_current.textproto> \
-existingVersions <PATH_TO_all_firebase_ios_sdks.textproto> \
swift run ReleasePackager -updatePodRepo true \
-repoDir <PATH_TO_current.firebase_ios_sdk.repo> \
-customSpecRepos sso://cpdc-internal/firebase
-carthageDir <PATH_TO_Firebase/CarthageScripts/json>
-carthageBuild true
-keepBuildArtifacts true
```

### Carthage

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

## Firebase Pod Updater
## Firebase Releaser

Updates the Firebase pod based on the release proto.

Run with the following two required options like:

- -releasingPods /path/to/M57.textproto
- -gitRoot /path/to/firebase-ios-sdk

### Running the Tool

You can run the tool with `swift run UpdateFirebasePod [ARGS]` or generate an
Xcode project with `swift package generate-xcodeproj` and run within Xcode.
Provides several functions for staging a Firebase release candidate. See the internal go/firi link
for the process documentation.

### Launch Arguments

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

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

## Development and Debugging

You can generate an Xcode project for the tool by running `swift package generate-xcodeproj` in this directory.
See the above instructions for adding Launch Arguments to the Xcode build.

## Development Philosophy

The following section describes the priorities taken while building this tool and should be followed
Expand Down Expand Up @@ -168,7 +150,3 @@ files and folders.
### Prefer File `URL`s over Strings
Instead of relying on `String`s to represent file paths, use `URL`s as soon as possible to avoid any
missed or double slashes along with other issues.

## Updating protobuf generated Swift files
- Install [Swift Protobuf](https://github.com/apple/swift-protobuf#building-and-installing-the-code-generator-plugin)
- Run `protoc Sources/ManifestReader/*.proto --swift_opt=Visibility=Public --swift_out=./`
38 changes: 21 additions & 17 deletions ZipBuilder/Sources/FirebaseManifest/FirebaseManifest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,35 @@ public let shared = Manifest(
Pod("FirebaseInstallations"),
Pod("FirebaseInstanceID"),
Pod("GoogleAppMeasurement", isClosedSource: true),
Pod("FirebaseAnalytics", isClosedSource: true),
Pod("FirebaseABTesting"),
Pod("FirebaseAppDistribution", isBeta: true),
Pod("FirebaseAuth"),
Pod("FirebaseCrashlytics"),
Pod("FirebaseDatabase"),
Pod("FirebaseDynamicLinks"),
Pod("FirebaseFirestore", allowWarnings: true),
Pod("FirebaseAnalytics", isClosedSource: true, zip: true),
Pod("FirebaseABTesting", zip: true),
Pod("FirebaseAppDistribution", isBeta: true, zip: true),
Pod("FirebaseAuth", zip: true),
Pod("FirebaseCrashlytics", zip: true),
Pod("FirebaseDatabase", zip: true),
Pod("FirebaseDynamicLinks", zip: true),
Pod("FirebaseFirestore", allowWarnings: true, zip: true),
Pod("FirebaseFirestoreSwift", isBeta: true),
Pod("FirebaseFunctions"),
Pod("FirebaseInAppMessaging", isBeta: true),
Pod("FirebaseMessaging"),
Pod("FirebasePerformance", isClosedSource: true),
Pod("FirebaseRemoteConfig"),
Pod("FirebaseStorage"),
Pod("FirebaseFunctions", zip: true),
Pod("FirebaseInAppMessaging", isBeta: true, zip: true),
Pod("FirebaseMessaging", zip: true),
Pod("FirebasePerformance", isClosedSource: true, zip: true),
Pod("FirebaseRemoteConfig", zip: true),
Pod("FirebaseStorage", zip: true),
Pod("FirebaseStorageSwift", isBeta: true),
Pod("FirebaseMLCommon", isClosedSource: true, isBeta: true),
Pod("FirebaseMLModelInterpreter", isClosedSource: true, isBeta: true),
Pod("FirebaseMLVision", isClosedSource: true, isBeta: true),
Pod("Firebase", allowWarnings: true),
Pod("FirebaseMLModelInterpreter", isClosedSource: true, isBeta: true, zip: true),
Pod("FirebaseMLVision", isClosedSource: true, isBeta: true, zip: true),
Pod("Firebase", allowWarnings: true, zip: true),
]
)

/// Manifest describing the contents of a Firebase release.
public struct Manifest {
public let version: String
public let pods: [Pod]

public func versionString(_ pod: Pod) -> String {
return pod.podVersion ?? (pod.isBeta ? version + "-beta" : version)
}
}
5 changes: 4 additions & 1 deletion ZipBuilder/Sources/FirebaseManifest/Pod.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,24 @@ public struct Pod {
public let allowWarnings: Bool // Allow validation warnings. Ideally these should all be false
public let podVersion: String? // Non-Firebase pods have their own version
public let releasing: Bool // Non-Firebase pods may not release
public let zip: Bool // Top level pod in Zip Distribution

init(_ name: String,
isClosedSource: Bool = false,
isBeta: Bool = false,
isFirebase: Bool = true,
allowWarnings: Bool = false,
podVersion: String? = nil,
releasing: Bool = true) {
releasing: Bool = true,
zip: Bool = false) {
self.name = name
self.isClosedSource = isClosedSource
self.isBeta = isBeta
self.isFirebase = isFirebase
self.allowWarnings = allowWarnings
self.podVersion = podVersion
self.releasing = releasing
self.zip = zip
}

public func podspecName() -> String {
Expand Down
3 changes: 1 addition & 2 deletions ZipBuilder/Sources/FirebaseReleaser/InitializeRelease.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ struct InitializeRelease {
if pod.name == "Firebase" {
updateFirebasePodspec(path: path, manifest: manifest)
} else {
let version = pod.podVersion ??
(pod.isBeta ? manifest.version + "-beta" : manifest.version)
let version = manifest.versionString(pod)

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