Skip to content

Commit fa0f140

Browse files
committed
Style and restoration of ZipBuilder buildRoot option
1 parent 4824fb0 commit fa0f140

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

ZipBuilder/Sources/FirebaseReleaser/Push.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ struct Push {
3131
let warningsOK = pod.allowWarnings ? " --allow-warnings" : ""
3232

3333
Shell.executeCommand("pod repo push --skip-tests --use-json \(warningsOK) \(cpdcLocation) " +
34-
pod.skipImportValidation() + " \(pod.podspecName()) " + "--sources=sso://cpdc-internal/firebase.git,https://cdn.cocoapods.org",
35-
workingDir: gitRoot)
34+
pod.skipImportValidation() + " \(pod.podspecName()) " +
35+
"--sources=sso://cpdc-internal/firebase.git,https://cdn.cocoapods.org",
36+
workingDir: gitRoot)
3637
}
3738
}
3839

ZipBuilder/Sources/Utils/FileManager+Utils.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,21 @@ public extension FileManager {
110110

111111
static let unique: String = timeStamp()
112112

113+
/// Allow clients to override default location for temporary directory creation
114+
static var buildRoot: URL?
115+
static func registerBuildRoot(buildRoot: URL) {
116+
FileManager.buildRoot = buildRoot
117+
}
118+
113119
/// Returns a deterministic path of a temporary directory for the given name. Note: This does
114120
/// *not* create the directory if it doesn't exist, merely generates the name for creation.
115121
func temporaryDirectory(withName name: String) -> URL {
116122
// Get access to the temporary directory. This could be passed in via `LaunchArgs`, or use the
117123
// default temporary directory.
118124
let tempDir: URL
119-
// if let root = LaunchArgs.shared.buildRoot {
120-
// tempDir = root
121-
// } else
125+
if let root = FileManager.buildRoot {
126+
tempDir = root
127+
} else
122128
if #available(OSX 10.12, *) {
123129
tempDir = temporaryDirectory
124130
} else {

ZipBuilder/Sources/Utils/ShellUtils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public extension Shell {
120120
print("Could not get data from pipe for command \(command): \(pipe.availableData)")
121121
return
122122
}
123-
if (line != "") {
123+
if line != "" {
124124
output.append(line)
125125
}
126126
print(line)

ZipBuilder/Sources/ZipBuilder/LaunchArgs.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import Foundation
18+
import Utils
1819

1920
/// Describes an object that can check if a file eists in the filesystem. Used to allow for better
2021
/// testing with FileManager.
@@ -331,6 +332,7 @@ struct LaunchArgs {
331332
}
332333

333334
self.buildRoot = url.standardizedFileURL
335+
FileManager.registerBuildRoot(buildRoot: url.standardizedFileURL)
334336
} else {
335337
// No argument was passed in.
336338
buildRoot = nil

0 commit comments

Comments
 (0)