Skip to content

Commit 651402c

Browse files
authored
Eliminate repo-dir option (#7201)
1 parent 450d463 commit 651402c

File tree

5 files changed

+20
-28
lines changed

5 files changed

+20
-28
lines changed

.github/workflows/zip.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ jobs:
2525
2626
package:
2727
# Don't run on private repo.
28-
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
28+
# TODO: Recomment before master merge
29+
# if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
2930
needs: build
3031
runs-on: macOS-latest
3132
steps:

ReleaseTooling/README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ You can pass in launch arguments with Xcode by clicking "zip-builder" beside the
3939

4040
These arguments assume you're running the command from the `ReleaseTooling` directory.
4141

42-
**Required** arguments:
43-
44-
- `--repo-dir <PATH_TO_firebase_ios_sdk_REPO>`
45-
- The root of the `firebase-ios-sdk` repo.
46-
4742
Typical argument (all use cases except Firebase release build):
4843
- `--zip-pods <PATH_TO.json>`
4944
- This is a JSON list of the pods to consolidate into a zip of binary frameworks. For example,
@@ -77,15 +72,13 @@ For release engineers (Googlers packaging an upcoming Firebase release) these co
7772
be used:
7873
- `--custom-spec-repos sso://cpdc-internal/firebase`
7974
- This pulls the latest podspecs from the CocoaPods staging area.
80-
- `--repo-dir path` GitHub repo containing Template and Carthage json file inputs.
8175
- `--enable-carthage-build` Turns on generation of Carthage zips and json file updates.
8276
- `--keep-build-artifacts` Useful for debugging and verifying the zip build contents.
8377

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

8680
```
8781
swift run zip-builder --update-pod-repo \
88-
--repo-dir <PATH_TO_current.firebase_ios_sdk.repo> \
8982
--custom-spec-repos sso://cpdc-internal/firebase \
9083
--enable-carthage-build \
9184
--keep-build-artifacts

ReleaseTooling/Sources/ZipBuilder/main.swift

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,6 @@ struct ZipBuilderTool: ParsableCommand {
128128

129129
// MARK: - Filesystem Paths
130130

131-
/// The path to the root of the firebase-ios-sdk repo.
132-
@Option(help: ArgumentHelp("""
133-
The path to the repo from which the Firebase distribution is being built.
134-
"""),
135-
transform: URL.init(fileURLWithPath:))
136-
var repoDir: URL
137-
138131
/// Path to override podspec search with local podspec.
139132
@Option(help: ArgumentHelp("Path to override podspec search with local podspec."),
140133
transform: URL.init(fileURLWithPath:))
@@ -160,17 +153,6 @@ struct ZipBuilderTool: ParsableCommand {
160153
// MARK: - Validation
161154

162155
mutating func validate() throws {
163-
// Validate the repoDir exists, as well as the templateDir.
164-
guard FileManager.default.directoryExists(at: repoDir) else {
165-
throw ValidationError("Included a repo-dir that doesn't exist.")
166-
}
167-
168-
// Validate the templateDir exists.
169-
let templateDir = ZipBuilder.FilesystemPaths.templateDir(fromRepoDir: repoDir)
170-
guard FileManager.default.directoryExists(at: templateDir) else {
171-
throw ValidationError("Missing template inside of the repo. \(templateDir) does not exist.")
172-
}
173-
174156
// Validate the output directory if provided.
175157
if let outputDir = outputDir, !FileManager.default.directoryExists(at: outputDir) {
176158
throw ValidationError("`output-dir` passed in does not exist. Value: \(outputDir)")
@@ -216,6 +198,22 @@ struct ZipBuilderTool: ParsableCommand {
216198
FileManager.registerBuildRoot(buildRoot: buildRoot.standardizedFileURL)
217199
}
218200

201+
// Get the repoDir by deleting four path components from this file to the repo root.
202+
let repoDir = URL(fileURLWithPath: #file)
203+
.deletingLastPathComponent().deletingLastPathComponent()
204+
.deletingLastPathComponent().deletingLastPathComponent()
205+
206+
// Validate the repoDir exists, as well as the templateDir.
207+
guard FileManager.default.directoryExists(at: repoDir) else {
208+
fatalError("Failed to find the repo root at \(repoDir).")
209+
}
210+
211+
// Validate the templateDir exists.
212+
let templateDir = ZipBuilder.FilesystemPaths.templateDir(fromRepoDir: repoDir)
213+
guard FileManager.default.directoryExists(at: templateDir) else {
214+
fatalError("Missing template inside of the repo. \(templateDir) does not exist.")
215+
}
216+
219217
let paths = ZipBuilder.FilesystemPaths(repoDir: repoDir,
220218
buildRoot: buildRoot,
221219
outputDir: outputDir,

scripts/build_non_firebase_sdks.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ do
3535
done
3636
echo "]" >> "${ZIP_POD_JSON}"
3737
mkdir -p "${REPO}"/sdk_zip
38-
swift run zip-builder --keep-build-artifacts --update-pod-repo --repo-dir "${REPO}" \
38+
swift run zip-builder --keep-build-artifacts --update-pod-repo\
3939
--zip-pods "${ZIP_POD_JSON}" --output-dir "${REPO}"/sdk_zip --disable-build-dependencies
4040

4141
unzip -o "${REPO}"/sdk_zip/Frameworks.zip -d "${HOME}"/ios_frameworks/Firebase/

scripts/build_zip.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ OUTPUT_DIR="$REPO/$1"
2727

2828
cd ReleaseTooling
2929
swift run zip-builder --keep-build-artifacts --update-pod-repo \
30-
--repo-dir "${REPO}" --local-podspec-path "${REPO}" \
30+
--local-podspec-path "${REPO}" \
3131
--enable-carthage-build --output-dir "${OUTPUT_DIR}" \
3232
--custom-spec-repos https://github.com/firebase/SpecsStaging.git

0 commit comments

Comments
 (0)