Skip to content

Commit 928abea

Browse files
authored
Use Package Access Modifier (#249)
Downgrade existing types to use the `package` access level modifier. In a future PR, introduce a public type for `XCBeautifyLib` consumers.
1 parent 385a721 commit 928abea

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

Sources/XcbeautifyLib/Constants.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ enum Symbol {
2020

2121
/// Specifies the xcodebuild console output type.
2222
/// As an example, a compiler warning, a compiler error, a test case, etc.
23-
public enum OutputType {
23+
package enum OutputType {
2424
case undefined
2525
case task
2626
case test

Sources/XcbeautifyLib/JunitReporter.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
import Foundation
77
import XMLCoder
88

9-
public final class JunitReporter {
9+
package final class JunitReporter {
1010
private var components: [JunitComponent] = []
1111
// Parallel output does not guarantee order - so it is _very_ hard
1212
// to match to the parent suite. We can still capture test success/failure
1313
// and output a generic result file.
1414
private var parallelComponents: [JunitComponent] = []
1515

16-
public init() { }
16+
package init() { }
1717

18-
public func add(line: String) {
18+
package func add(line: String) {
1919
// Remove any preceding or excessive spaces
2020
let line = line.trimmingCharacters(in: .whitespacesAndNewlines)
2121

@@ -80,7 +80,7 @@ public final class JunitReporter {
8080
return group.testSuiteName
8181
}
8282

83-
public func generateReport() throws -> Data {
83+
package func generateReport() throws -> Data {
8484
let parser = JunitComponentParser()
8585
components.forEach { parser.parse(component: $0) }
8686
// Prefix a fake test suite start for the parallel tests.

Sources/XcbeautifyLib/OutputHandler.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
public class OutputHandler {
3+
package class OutputHandler {
44
let quiet: Bool
55
let quieter: Bool
66
let isCI: Bool
@@ -16,14 +16,14 @@ public class OutputHandler {
1616
/// Ref: https://github.com/cpisciotta/xcbeautify/pull/15
1717
private var lastFormatted: String?
1818

19-
public init(quiet: Bool, quieter: Bool, isCI: Bool = false, _ writer: @escaping (String) -> Void) {
19+
package init(quiet: Bool, quieter: Bool, isCI: Bool = false, _ writer: @escaping (String) -> Void) {
2020
self.quiet = quiet
2121
self.quieter = quieter
2222
self.isCI = isCI
2323
self.writer = writer
2424
}
2525

26-
public func write(_ type: OutputType, _ content: String?) {
26+
package func write(_ type: OutputType, _ content: String?) {
2727
guard let content else { return }
2828

2929
if !quiet, !quieter {

Sources/XcbeautifyLib/Parser.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
public class Parser {
1+
package class Parser {
22
private let colored: Bool
33

44
private let renderer: OutputRendering
@@ -9,9 +9,9 @@ public class Parser {
99

1010
private(set) var needToRecordSummary = false
1111

12-
public var preserveUnbeautifiedLines = false
12+
private let preserveUnbeautifiedLines: Bool
1313

14-
public var outputType = OutputType.undefined
14+
package private(set) var outputType = OutputType.undefined
1515

1616
private lazy var captureGroupTypes: [CaptureGroup.Type] = [
1717
AnalyzeCaptureGroup.self,
@@ -98,7 +98,7 @@ public class Parser {
9898

9999
// MARK: - Init
100100

101-
public init(
101+
package init(
102102
colored: Bool = true,
103103
renderer: Renderer,
104104
preserveUnbeautifiedLines: Bool = false,
@@ -117,7 +117,7 @@ public class Parser {
117117
self.additionalLines = additionalLines
118118
}
119119

120-
public func parse(line: String) -> String? {
120+
package func parse(line: String) -> String? {
121121
// Find first parser that can parse specified string
122122
guard let idx = captureGroupTypes.firstIndex(where: { $0.regex.match(string: line) }) else {
123123
// Some uncommon cases, which have additional logic and don't follow default flow
@@ -168,7 +168,7 @@ public class Parser {
168168
return formattedOutput
169169
}
170170

171-
public func formattedSummary() -> String? {
171+
package func formattedSummary() -> String? {
172172
guard let summary else { return nil }
173173
return renderer.format(testSummary: summary)
174174
}

0 commit comments

Comments
 (0)