3
3
This project includes Firebase release tooling including a zip builder and a
4
4
Firebase release candidate creation tool.
5
5
6
- The tools are designed to fail fast with an explanation of what went wrong, so
7
- you can fix issues or dig in without having to dig too deep into the code.
6
+ The rest of this file documents using the ` zip-builder ` tool. Information about the rest of the
7
+ tools for managing Firebase releases and information about developing these tools is at
8
+ [ DEVELOP.md] ( DEVELOP.md )
8
9
9
10
## Zip Builder
10
11
11
- This is a Swift Package Manager project that allows users to package an iOS Zip file of binary
12
- packages .
12
+ The ` zip-builder ` tool generates a zip distribution of binary ` .xcframeworks ` from an input set of
13
+ CocoaPods .
13
14
14
15
### Requirements
15
16
@@ -21,10 +22,10 @@ In order to build the Zip file, you will need:
21
22
22
23
### Running the Tool
23
24
24
- You can run the tool with ` swift run zip-builder [ARGS] ` or generate an Xcode project with
25
- ` swift package generate-xcodeproj ` and run within Xcode.
25
+ You can run the tool with ` swift run zip-builder [ARGS] ` or ` open Package.swift ` to debug or run
26
+ within Xcode.
26
27
27
- Since Apple does not support linking libraries built by future Xcode versions, make sure to builid with the
28
+ Since Apple does not support linking libraries built by future Xcode versions, make sure to build with the
28
29
earliest Xcode needed by any of the library clients. The Xcode command line tools must also be configured
29
30
for that version. Check with ` xcodebuild -version ` .
30
31
@@ -37,14 +38,12 @@ You can pass in launch arguments with Xcode by clicking "zip-builder" beside the
37
38
38
39
#### Common Arguments
39
40
40
- These arguments assume you're running the command from the ` ReleaseTooling ` directory .
41
+ Use ` pods <pods> ` to specify the CocoaPods to build .
41
42
42
- ** Required** arguments:
43
+ The ` pods ` option will choose whatever pods get installed from an unversioned CocoaPods install,
44
+ typically the latest versions.
43
45
44
- - ` --repo-dir <PATH_TO_firebase_ios_sdk_REPO> `
45
- - The root of the ` firebase-ios-sdk ` repo.
46
-
47
- Typical argument (all use cases except Firebase release build):
46
+ To explicitly specify the CocoaPods versions, use a JSON specification :
48
47
- ` --zip-pods <PATH_TO.json> `
49
48
- This is a JSON list of the pods to consolidate into a zip of binary frameworks. For example,
50
49
@@ -64,90 +63,13 @@ Indicates to install the version 3.2.0 of "GoogleDataTransport" and the latest
64
63
version of "FirebaseMessaging". The version string is optional and can be any
65
64
valid [ CocoaPods Podfile version specifier] ( https://guides.cocoapods.org/syntax/podfile.html#pod ) .
66
65
67
-
68
- Optional common arguments:
66
+ Other optional arguments:
69
67
- ` --no-update-pod-repo `
70
68
- This is for speedups when ` pod repo update ` has already been run recently.
71
-
72
- For release engineers (Googlers packaging an upcoming Firebase release) these commands should also be used:
73
- - ` --custom-spec-repos sso://cpdc-internal/firebase `
74
- - This pulls the latest podspecs from the CocoaPods staging area.
75
- - ` --repo-dir path ` GitHub repo containing Template and Carthage json file inputs.
76
- - ` --enable-carthage-build ` Turns on generation of Carthage zips and json file updates.
77
- - ` --keep-build-artifacts ` Useful for debugging and verifying the zip build contents.
78
-
79
- Putting them all together, here's a common command to build a releaseable Zip file:
80
-
81
- ```
82
- swift run zip-builder --update-pod-repo \
83
- --repo-dir <PATH_TO_current.firebase_ios_sdk.repo> \
84
- --custom-spec-repos sso://cpdc-internal/firebase \
85
- --enable-carthage-build \
86
- --keep-build-artifacts
87
- ```
88
-
89
- ### Carthage
90
-
91
- Carthage binaries can also be built at the same time as the zip file by passing in ` --enable-carthage-build `
92
- as a command line argument. This directory should contain JSON files describing versions and download
93
- locations for each product. This will result in a folder called "carthage" at the root where the zip directory exists
94
- containing all the zip files and JSON files necessary for distribution.
95
-
96
- ## Firebase Releaser
97
-
98
- Provides several functions for staging a Firebase release candidate. See the internal go/firi link
99
- for the process documentation.
100
-
101
- ### Launch Arguments
102
-
103
- See ` main.swift ` for information on specific launch arguments.
104
-
105
- You can pass in launch arguments with Xcode by selecting the "firebase-releaser" scheme
106
- beside the Run/Stop buttons, clicking "Edit Scheme" and adding them in the "Arguments Passed On Launch"
107
- section.
108
-
109
- ## Development Philosophy
110
-
111
- The following section describes the priorities taken while building this tool and should be followed
112
- for any modifications.
113
-
114
- ### Readable and Maintainable
115
- This code will rarely be modified outside of bug fixes, but read very frequently. There should be no
116
- "magic lines" that do multiple things. Verbosity is preferred over making the code shorter and
117
- performing multiple actions at once. All functions should be well documented.
118
-
119
- ### Avoid Calling bash Commands Where Possible
120
- Instead of using ` cat ` , ` find ` , ` grep ` , or ` perl ` use ` String ` APIs to read the contents of a file,
121
- ` FileManager ` to properly list contents of a directory, ` RegularExpression ` for pattern matching,
122
- etc. If there's a ` Foundation ` API available, it should be used.
123
-
124
- ### Understandable Output
125
- The output of the script should make it immediately obvious if there were any issues and exactly
126
- what those issues were, without looking at the code. It should also be very clear if the Zip file
127
- was properly built and output the file location.
128
-
129
- ### Show Xcode and API Output on Failures
130
- In the event that there's an Xcode build failure, the logs should be surfaced immediately to aid
131
- debugging. Release engineers should not have to find the Xcode project manually. That being said, a
132
- link to the Xcode project file should be logged as well in case it's necessary. Same goes for errors
133
- logged by exceptions (ex: ` FileManager ` ).
134
-
135
- ### Testable and Debuggable
136
- Components and functions should be split up in a way that make them easy to test and easy to debug.
137
- Prefer small functions that have proper failure conditions and input validated with ` guard `
138
- statements, throwing ` fatalError ` with a well written error message if it's a critical issue that
139
- prevents the Zip file from being built properly.
140
-
141
- ### Works from the Command Line or Xcode (Environment Agnostic)
142
- The script should be able to run from the command line to allow for easier automation and Xcode for
143
- simpler debugging and maintenance.
144
-
145
- ### Any Failure Exits Immediately
146
- The script should not continue if anything necessary for a successful Zip file fails. This includes
147
- things like compiling storyboards, moving resources, missing files, etc. This is to ensure the
148
- integrity of the zip file and that any issues during testing are SDK bugs and not related to the
149
- files and folders.
150
-
151
- ### Prefer File ` URL ` s over Strings
152
- Instead of relying on ` String ` s to represent file paths, use ` URL ` s as soon as possible to avoid any
153
- missed or double slashes along with other issues.
69
+ - ` --minimum-ios-version <minimum-ios-version> `
70
+ - Change the minimimum iOS version from the default of 10.
71
+ - ` --output-dir <output-dir> `
72
+ - The directory to copy the built Zip file. If this is not set, the path to the Zip file will
73
+ be logged to the console.
74
+ - ` --keep-build-artifacts `
75
+ - Keep the build artifacts.
0 commit comments