Skip to content

Commit e361921

Browse files
authored
Add --pods option (#7204)
1 parent 87da822 commit e361921

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

ReleaseTooling/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,12 @@ You can pass in launch arguments with Xcode by clicking "zip-builder" beside the
3838

3939
#### Common Arguments
4040

41-
These arguments assume you're running the command from the `ReleaseTooling` directory.
41+
Use `pods <pods>` to specify the CocoaPods to build.
4242

43-
Typical argument (all use cases except Firebase release build):
43+
The `pods` option will choose whatever pods get installed from an unversioned CocoaPods install,
44+
typically the latest versions.
45+
46+
To explicitly specify the CocoaPods versions, use a JSON specification :
4447
- `--zip-pods <PATH_TO.json>`
4548
- This is a JSON list of the pods to consolidate into a zip of binary frameworks. For example,
4649

@@ -60,11 +63,11 @@ Indicates to install the version 3.2.0 of "GoogleDataTransport" and the latest
6063
version of "FirebaseMessaging". The version string is optional and can be any
6164
valid [CocoaPods Podfile version specifier](https://guides.cocoapods.org/syntax/podfile.html#pod).
6265

63-
Optional common arguments:
66+
Other optional arguments:
6467
- `--no-update-pod-repo`
6568
- This is for speedups when `pod repo update` has already been run recently.
6669
- `--minimum-ios-version <minimum-ios-version>`
6770
- Change the minimimum iOS version from the default of 10.
6871
- `--output-dir <output-dir>`
69-
- The directory to copy the built Zip file to. If this is not set, the path to the Zip file will
72+
- The directory to copy the built Zip file. If this is not set, the path to the Zip file will
7073
be logged to the console.

ReleaseTooling/Sources/ZipBuilder/main.swift

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@ struct ZipBuilderTool: ParsableCommand {
114114
"""))
115115
var platforms: [TargetPlatform]
116116

117-
// MARK: - Zip Pods
117+
// MARK: - Specify Pods
118+
119+
@Option(parsing: .upToNextOption,
120+
help: ArgumentHelp("List of pods to build."))
121+
var pods: [String]
118122

119123
@Option(help: ArgumentHelp("""
120124
The path to a JSON file of the pods (with optional version) to package into a zip.
@@ -246,11 +250,20 @@ struct ZipBuilderTool: ParsableCommand {
246250
}
247251
}
248252

249-
if let zipPods = zipPods {
250-
let (installedPods, frameworks, _) = builder.buildAndAssembleZip(podsToInstall: zipPods,
251-
inProjectDir: projectDir,
252-
minimumIOSVersion: minimumIOSVersion,
253-
includeDependencies: buildDependencies)
253+
var podsToBuild = zipPods
254+
if pods.count > 0 {
255+
guard podsToBuild == nil else {
256+
fatalError("Only one of `--zipPods` or `--pods` can be specified.")
257+
}
258+
podsToBuild = pods.map { CocoaPodUtils.VersionedPod(name: $0, version: nil) }
259+
}
260+
261+
if let podsToBuild = podsToBuild {
262+
let (installedPods, frameworks, _) =
263+
builder.buildAndAssembleZip(podsToInstall: podsToBuild,
264+
inProjectDir: projectDir,
265+
minimumIOSVersion: minimumIOSVersion,
266+
includeDependencies: buildDependencies)
254267
let staging = FileManager.default.temporaryDirectory(withName: "staging")
255268
try builder.copyFrameworks(fromPods: Array(installedPods.keys), toDirectory: staging,
256269
frameworkLocations: frameworks)

0 commit comments

Comments
 (0)