Skip to content

Commit f2e0a5e

Browse files
authored
ZipBuilder: Remove unnecessary public's (#4456)
1 parent 2cc26bd commit f2e0a5e

10 files changed

+42
-42
lines changed

ZipBuilder/Sources/ZipBuilder/CarthageUtils.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import Foundation
1919

2020
/// Carthage related utility functions. The enum type is used as a namespace here instead of having
2121
/// root functions, and no cases should be added to it.
22-
public enum CarthageUtils {}
22+
enum CarthageUtils {}
2323

24-
public extension CarthageUtils {
24+
extension CarthageUtils {
2525
/// Generates all required files for a Carthage release.
2626
///
2727
/// - Parameters:

ZipBuilder/Sources/ZipBuilder/CocoaPodUtils.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ import Foundation
1818

1919
/// CocoaPod related utility functions. The enum type is used as a namespace here instead of having
2020
/// root functions, and no cases should be added to it.
21-
public enum CocoaPodUtils {
21+
enum CocoaPodUtils {
2222
// MARK: - Public API
2323

24-
public struct VersionedPod: Decodable {
24+
struct VersionedPod: Decodable {
2525
/// Public name of the pod.
2626
let name: String
2727

@@ -30,7 +30,7 @@ public enum CocoaPodUtils {
3030
}
3131

3232
/// Information associated with an installed pod.
33-
public struct PodInfo {
33+
struct PodInfo {
3434
/// The version of the generated pod.
3535
let version: String
3636

@@ -42,7 +42,7 @@ public enum CocoaPodUtils {
4242
}
4343

4444
/// Executes the `pod cache clean --all` command to remove any cached CocoaPods.
45-
public static func cleanPodCache() {
45+
static func cleanPodCache() {
4646
let result = Shell.executeCommandFromScript("pod cache clean --all", outputToConsole: false)
4747
switch result {
4848
case let .error(code):
@@ -56,7 +56,7 @@ public enum CocoaPodUtils {
5656
}
5757

5858
/// Gets metadata from installed Pods. Reads the `Podfile.lock` file and parses it.
59-
public static func installedPodsInfo(inProjectDir projectDir: URL) -> [String: PodInfo] {
59+
static func installedPodsInfo(inProjectDir projectDir: URL) -> [String: PodInfo] {
6060
// Read from the Podfile.lock to get the installed versions and names.
6161
let podfileLock: String
6262
do {
@@ -78,9 +78,9 @@ public enum CocoaPodUtils {
7878
/// - customSpecRepos: Additional spec repos to check for installation.
7979
/// - Returns: A dictionary of PodInfo's keyed by the pod name.
8080
@discardableResult
81-
public static func installPods(_ pods: [VersionedPod],
82-
inDir directory: URL,
83-
customSpecRepos: [URL]? = nil) -> [String: PodInfo] {
81+
static func installPods(_ pods: [VersionedPod],
82+
inDir directory: URL,
83+
customSpecRepos: [URL]? = nil) -> [String: PodInfo] {
8484
let fileManager = FileManager.default
8585
// Ensure the directory exists, otherwise we can't install all subspecs.
8686
guard fileManager.directoryExists(at: directory) else {
@@ -126,7 +126,7 @@ public enum CocoaPodUtils {
126126
///
127127
/// - Parameter contents: The contents of a `Podfile.lock` file.
128128
/// - Returns: A dictionary of PodInfo structs keyed by the pod name.
129-
public static func loadPodInfoFromPodfileLock(contents: String) -> [String: PodInfo] {
129+
static func loadPodInfoFromPodfileLock(contents: String) -> [String: PodInfo] {
130130
// This pattern matches a pod name with its version (two to three components)
131131
// Examples:
132132
// - FirebaseUI/Google (4.1.1):
@@ -187,7 +187,7 @@ public enum CocoaPodUtils {
187187
return installedPods
188188
}
189189

190-
public static func updateRepos() {
190+
static func updateRepos() {
191191
let result = Shell.executeCommandFromScript("pod repo update")
192192
switch result {
193193
case let .error(_, output):
@@ -197,7 +197,7 @@ public enum CocoaPodUtils {
197197
}
198198
}
199199

200-
public static func podInstallPrepare(inProjectDir projectDir: URL) {
200+
static func podInstallPrepare(inProjectDir projectDir: URL) {
201201
do {
202202
// Create the directory and all intermediate directories.
203203
try FileManager.default.createDirectory(at: projectDir, withIntermediateDirectories: true)

ZipBuilder/Sources/ZipBuilder/FileManager+Utils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import Foundation
1818

1919
// Extensions to FileManager that make scripting easier or cleaner for error reporting.
20-
public extension FileManager {
20+
extension FileManager {
2121
// MARK: - Helper Enum Declarations
2222

2323
/// Describes a type of file to be searched for.

ZipBuilder/Sources/ZipBuilder/FirebasePods.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Foundation
1818

1919
// TODO: Auto generate this list from the Firebase.podspec and others, probably with a script.
2020
/// All the CocoaPods related to packaging and distributing Firebase.
21-
public enum FirebasePods: String, CaseIterable {
21+
enum FirebasePods: String, CaseIterable {
2222
case abTesting = "FirebaseABTesting"
2323
case adMob = "Google-Mobile-Ads-SDK"
2424
case analytics = "FirebaseAnalytics"
@@ -50,7 +50,7 @@ public enum FirebasePods: String, CaseIterable {
5050
case storage = "FirebaseStorage"
5151

5252
/// Flag to explicitly exclude any Resources from being copied.
53-
public var excludeResources: Bool {
53+
var excludeResources: Bool {
5454
switch self {
5555
case .mlVision, .mlVisionBarcodeModel, .mlVisionLabelModel:
5656
return true
@@ -60,7 +60,7 @@ public enum FirebasePods: String, CaseIterable {
6060
}
6161

6262
/// Describes the dependency on other frameworks for the README file.
63-
public static func readmeHeader(podName: String) -> String {
63+
static func readmeHeader(podName: String) -> String {
6464
var header = "## \(podName)"
6565
if !(podName == "FirebaseAnalytics" || podName == "GoogleSignIn") {
6666
header += " (~> FirebaseAnalytics)"
@@ -74,7 +74,7 @@ public enum FirebasePods: String, CaseIterable {
7474
/// Returns folders to remove from the Zip file from a specific pod for de-duplication. This
7575
/// is necessary for the MLKit frameworks because of their unique structure, an unnecessary amount
7676
/// of frameworks get pulled in.
77-
public static func duplicateFrameworksToRemove(pod: String) -> [String] {
77+
static func duplicateFrameworksToRemove(pod: String) -> [String] {
7878
switch pod {
7979
case "FirebaseMLVisionBarcodeModel", "FirebaseMLVisionFaceModel", "FirebaseMLVisionLabelModel",
8080
"FirebaseMLVisionTextModel":

ZipBuilder/Sources/ZipBuilder/FrameworkBuilder.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import Foundation
1818

1919
/// Different architectures to build frameworks for.
20-
public enum Architecture: String, CaseIterable {
20+
enum Architecture: String, CaseIterable {
2121
/// The target platform that the framework is built for.
2222
enum TargetPlatform: String {
2323
case device = "iphoneos"
@@ -79,9 +79,9 @@ struct FrameworkBuilder {
7979
/// - version: String representation of the version.
8080
/// - Parameter logsOutputDir: The path to the directory to place build logs.
8181
/// - Returns: A URL to the framework that was built (or pulled from the cache).
82-
public func buildFramework(withName podName: String,
83-
version: String,
84-
logsOutputDir: URL? = nil) -> URL {
82+
func buildFramework(withName podName: String,
83+
version: String,
84+
logsOutputDir: URL? = nil) -> URL {
8585
print("Building \(podName)")
8686

8787
// Get (or create) the cache directory for storing built frameworks.

ZipBuilder/Sources/ZipBuilder/HashCalculator.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import Foundation
2020
/// Hashing related utility functions. The enum type is used as a namespace here instead of having
2121
/// root functions, and no cases should be added to it. Note: this would be named `Hasher` but it
2222
/// collide's with Foundation's `Hasher` type.
23-
public enum HashCalculator {}
23+
enum HashCalculator {}
2424

25-
public extension HashCalculator {
25+
extension HashCalculator {
2626
enum HashError: Error {
2727
/// Real errors aren't thrown, so just give text what happened.
2828
case failed(String)

ZipBuilder/Sources/ZipBuilder/ModuleMapBuilder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ struct ModuleMapBuilder {
8383

8484
/// Build the module map files for the source frameworks.
8585
///
86-
public func build() {
86+
func build() {
8787
for (_, info) in installedPods {
8888
if info.isSourcePod == false || info.transitiveFrameworks != nil {
8989
continue

ZipBuilder/Sources/ZipBuilder/ResourcesManager.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ extension ResourcesManager {
2626
/// - Parameter dir: The directory to search for any sign of resources.
2727
/// - Returns: True if any resources could be found, otherwise false.
2828
/// - Throws: A FileManager API that was thrown while searching.
29-
public static func directoryContainsResources(_ dir: URL) throws -> Bool {
29+
static func directoryContainsResources(_ dir: URL) throws -> Bool {
3030
// First search for any .bundle files.
3131
let fileManager = FileManager.default
3232
let bundles = try fileManager.recursivelySearch(for: .bundles, in: dir)
@@ -58,8 +58,8 @@ extension ResourcesManager {
5858
/// - Returns: True if any resources were moved and packaged, otherwise false.
5959
/// - Throws: Any file system errors that occur.
6060
@discardableResult
61-
public static func packageAllResources(containedIn dir: URL,
62-
bundlesToIgnore: [String] = []) throws -> Bool {
61+
static func packageAllResources(containedIn dir: URL,
62+
bundlesToIgnore: [String] = []) throws -> Bool {
6363
let resourcesFound = try directoryContainsResources(dir)
6464

6565
// Quit early if there are no resources to deal with.
@@ -162,7 +162,7 @@ extension ResourcesManager {
162162
/// - Returns: An array of URLs pointing to the newly located bundles.
163163
/// - Throws: Any file system errors that occur.
164164
@discardableResult
165-
public static func moveAllBundles(inDirectory dir: URL, to resourceDir: URL) throws -> [URL] {
165+
static func moveAllBundles(inDirectory dir: URL, to resourceDir: URL) throws -> [URL] {
166166
let fileManager = FileManager.default
167167
let allBundles = try fileManager.recursivelySearch(for: .bundles, in: dir)
168168

@@ -183,7 +183,7 @@ extension ResourcesManager {
183183
/// This is a recrusive search.
184184
///
185185
/// - Parameter dir: The directory to recursively search for Resources directories in.
186-
public static func removeEmptyResourcesDirectories(in dir: URL) {
186+
static func removeEmptyResourcesDirectories(in dir: URL) {
187187
// Find all the Resources directories to begin with.
188188
let fileManager = FileManager.default
189189
guard let resourceDirs = try? fileManager.recursivelySearch(for: .directories(name: "Resources"), in: dir) else {

ZipBuilder/Sources/ZipBuilder/URL+Utils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import Foundation
1818

1919
/// Utilities to simplify URL manipulation.
20-
public extension URL {
20+
extension URL {
2121
/// Appends each item in the array as a component to the existing URL.
2222
func appendingPathComponents(_ components: [String]) -> URL {
2323
// Append multiple path components in a single call to prevent long lines of multiple calls.

ZipBuilder/Sources/ZipBuilder/ZipBuilder.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ import Foundation
1919
import ManifestReader
2020

2121
/// Misc. constants used in the build tool.
22-
public struct Constants {
22+
struct Constants {
2323
/// Constants related to the Xcode project template.
24-
public struct ProjectPath {
24+
struct ProjectPath {
2525
// Required for building.
26-
public static let infoPlist = "Info.plist"
27-
public static let projectFile = "FrameworkMaker.xcodeproj"
26+
static let infoPlist = "Info.plist"
27+
static let projectFile = "FrameworkMaker.xcodeproj"
2828

2929
/// All required files for building the Zip file.
30-
public static let requiredFilesForBuilding: [String] = [projectFile, infoPlist]
30+
static let requiredFilesForBuilding: [String] = [projectFile, infoPlist]
3131

3232
// Required for distribution.
33-
public static let readmeName = "README.md"
33+
static let readmeName = "README.md"
3434

3535
// Required from the Firebase pod.
36-
public static let firebaseHeader = "Firebase.h"
37-
public static let modulemap = "module.modulemap"
36+
static let firebaseHeader = "Firebase.h"
37+
static let modulemap = "module.modulemap"
3838

3939
/// The dummy Firebase library for Carthage distribution.
40-
public static let dummyFirebaseLib = "dummy_Firebase_lib"
40+
static let dummyFirebaseLib = "dummy_Firebase_lib"
4141

4242
// Make the struct un-initializable.
4343
@available(*, unavailable)
@@ -46,14 +46,14 @@ public struct Constants {
4646

4747
/// The text added to the README for a product if it contains Resources. The empty line at the end
4848
/// is intentional.
49-
public static let resourcesRequiredText = """
49+
static let resourcesRequiredText = """
5050
You'll also need to add the resources in the Resources
5151
directory into your target's main bundle.
5252
5353
"""
5454

5555
/// The name of the Core Diagnostics pod.
56-
public static let coreDiagnosticsName: String = "FirebaseCoreDiagnostics"
56+
static let coreDiagnosticsName: String = "FirebaseCoreDiagnostics"
5757

5858
// Make the struct un-initializable.
5959
@available(*, unavailable)

0 commit comments

Comments
 (0)