From b8bbccf397ee422dfec10b873780fa079a1d56a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Lo=CC=81pez=20Rocha?= Date: Fri, 4 Sep 2020 12:36:41 +0200 Subject: [PATCH 1/4] Add rootOutput option, to store the HTML report into the given path --- README.md | 1 + Sources/XCLogParser/commands/ActionOptions.swift | 6 +++++- .../XCLogParser/commands/CommandHandler.swift | 6 +++--- .../reporter/ChromeTracerReporter.swift | 2 +- .../XCLogParser/reporter/FlatJsonReporter.swift | 2 +- Sources/XCLogParser/reporter/HtmlReporter.swift | 14 ++++++++++---- .../XCLogParser/reporter/IssuesReporter.swift | 2 +- Sources/XCLogParser/reporter/JsonReporter.swift | 2 +- Sources/XCLogParser/reporter/LogReporter.swift | 2 +- .../reporter/SummaryJsonReporter.swift | 2 +- .../XCLogParserApp/commands/CommonCommand.swift | 4 ++++ .../XCLogParserApp/commands/ParseCommand.swift | 16 +++++++++++----- Tests/XCLogParserTests/IssuesReporterTests.swift | 4 ++-- 13 files changed, 42 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 78def12..579d89d 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,7 @@ Example output available in the [reporters](#reporters) section. | `--xcodeproj` | The path to the `xcodeproj` file if you don't know the path to the log and if the project doesn't have a `xcworkspace` file. It will generate the folder name for the project in the `DerivedData` folder using Xcode's hash algorithm and it will try to locate the latest Build Log inside that directory. | No * | | `--derived_data` | The path to the derived data folder if you are using `xcodebuild` to build your project with the `-derivedDataPath` option. | No | | `--output` | If specified, the JSON file will be written to the given path. If not defined, the command will output to the standard output. | No | + | `--rootOutput` | If specified, the HTML file will be written to the given folder. If the folder doesn't exist will be created. It works with relative home path.`~` | No | | `--redacted` | If specified, the username will be replaced by the word `redacted` in the file paths contained in the logs. Useful for privacy reasons but slightly decreases the performance. | No | | `--strictProjectName` | Used in conjunction with `--project`. If specified, a stricter name matching will be done for the project name. | No | | `--machine_name` | If specified, the machine name will be used to create the `buildIdentifier`. If it is not specified, the host name will be used. | No | diff --git a/Sources/XCLogParser/commands/ActionOptions.swift b/Sources/XCLogParser/commands/ActionOptions.swift index 32cd63a..2182761 100644 --- a/Sources/XCLogParser/commands/ActionOptions.swift +++ b/Sources/XCLogParser/commands/ActionOptions.swift @@ -38,10 +38,14 @@ public struct ActionOptions { /// With this option, a user can override it and provide a name that will be used in that identifier. public let machineName: String? - public init(reporter: Reporter, outputPath: String, redacted: Bool, machineName: String? = nil) { + /// The rootOutput will generate the HTML output in the given folder + public let rootOutput: String? + + public init(reporter: Reporter, outputPath: String, redacted: Bool, machineName: String? = nil, rootOutput: String? = nil) { self.reporter = reporter self.outputPath = outputPath self.redacted = redacted self.machineName = machineName + self.rootOutput = rootOutput } } diff --git a/Sources/XCLogParser/commands/CommandHandler.swift b/Sources/XCLogParser/commands/CommandHandler.swift index 77cb6dc..3f07d55 100644 --- a/Sources/XCLogParser/commands/CommandHandler.swift +++ b/Sources/XCLogParser/commands/CommandHandler.swift @@ -45,14 +45,14 @@ public struct CommandHandler { let logManifestEntries = try logManifest.getWithLogOptions(logOptions) let reporterOutput = ReporterOutputFactory.makeReporterOutput(path: actionOptions.outputPath) let logReporter = actionOptions.reporter.makeLogReporter() - try logReporter.report(build: logManifestEntries, output: reporterOutput) + try logReporter.report(build: logManifestEntries, output: reporterOutput, rootOutput: actionOptions.rootOutput) } func handleDump(fromLogURL logURL: URL, options: ActionOptions) throws { let activityLog = try activityLogParser.parseActivityLogInURL(logURL, redacted: options.redacted) let reporterOutput = ReporterOutputFactory.makeReporterOutput(path: options.outputPath) let logReporter = options.reporter.makeLogReporter() - try logReporter.report(build: activityLog, output: reporterOutput) + try logReporter.report(build: activityLog, output: reporterOutput, rootOutput: options.rootOutput) } func handleParse(fromLogURL logURL: URL, options: ActionOptions) throws { @@ -61,7 +61,7 @@ public struct CommandHandler { let buildSteps = try buildParser.parse(activityLog: activityLog) let reporterOutput = ReporterOutputFactory.makeReporterOutput(path: options.outputPath) let logReporter = options.reporter.makeLogReporter() - try logReporter.report(build: buildSteps, output: reporterOutput) + try logReporter.report(build: buildSteps, output: reporterOutput, rootOutput: options.rootOutput) } } diff --git a/Sources/XCLogParser/reporter/ChromeTracerReporter.swift b/Sources/XCLogParser/reporter/ChromeTracerReporter.swift index bf2b6d5..8bd2c70 100644 --- a/Sources/XCLogParser/reporter/ChromeTracerReporter.swift +++ b/Sources/XCLogParser/reporter/ChromeTracerReporter.swift @@ -25,7 +25,7 @@ public struct ChromeTracerReporter: LogReporter { private let microSecondsPerSecond: Double = 1_000_000 - public func report(build: Any, output: ReporterOutput) throws { + public func report(build: Any, output: ReporterOutput, rootOutput: String?) throws { guard let steps = build as? BuildStep else { throw XCLogParserError.errorCreatingReport("Type not supported \(type(of: build))") } diff --git a/Sources/XCLogParser/reporter/FlatJsonReporter.swift b/Sources/XCLogParser/reporter/FlatJsonReporter.swift index 01bc043..5078384 100644 --- a/Sources/XCLogParser/reporter/FlatJsonReporter.swift +++ b/Sources/XCLogParser/reporter/FlatJsonReporter.swift @@ -21,7 +21,7 @@ import Foundation public struct FlatJsonReporter: LogReporter { - public func report(build: Any, output: ReporterOutput) throws { + public func report(build: Any, output: ReporterOutput, rootOutput: String?) throws { guard let steps = build as? BuildStep else { throw XCLogParserError.errorCreatingReport("Type not supported \(type(of: build))") } diff --git a/Sources/XCLogParser/reporter/HtmlReporter.swift b/Sources/XCLogParser/reporter/HtmlReporter.swift index 3946bc3..81d1f49 100644 --- a/Sources/XCLogParser/reporter/HtmlReporter.swift +++ b/Sources/XCLogParser/reporter/HtmlReporter.swift @@ -23,7 +23,7 @@ import Foundation /// It uses the html and javascript files from the Resources folder as templates public struct HtmlReporter: LogReporter { - public func report(build: Any, output: ReporterOutput) throws { + public func report(build: Any, output: ReporterOutput, rootOutput: String?) throws { guard let steps = build as? BuildStep else { throw XCLogParserError.errorCreatingReport("Type not supported \(type(of: build))") } @@ -33,16 +33,22 @@ public struct HtmlReporter: LogReporter { guard let jsonString = String(data: json, encoding: .utf8) else { throw XCLogParserError.errorCreatingReport("Can't generate the JSON file.") } - try writeHtmlReport(for: steps, jsonString: jsonString, output: output) + try writeHtmlReport(for: steps, jsonString: jsonString, output: output, rootOutput: rootOutput) } - private func writeHtmlReport(for build: BuildStep, jsonString: String, output: ReporterOutput) throws { + private func writeHtmlReport(for build: BuildStep, jsonString: String, output: ReporterOutput, rootOutput: String?) throws { var path = "build/xclogparser/reports" + if let rootOutput = rootOutput { + path = FileOutput(path: rootOutput).path + } if let output = output as? FileOutput { path = output.path } let fileManager = FileManager.default - let buildDir = "\(path)/\(dirFor(build: build))" + var buildDir = "\(path)/\(dirFor(build: build))" + if rootOutput != nil { + buildDir = path + } try fileManager.createDirectory( atPath: "\(buildDir)/css", withIntermediateDirectories: true, diff --git a/Sources/XCLogParser/reporter/IssuesReporter.swift b/Sources/XCLogParser/reporter/IssuesReporter.swift index 254e6ea..52adf90 100644 --- a/Sources/XCLogParser/reporter/IssuesReporter.swift +++ b/Sources/XCLogParser/reporter/IssuesReporter.swift @@ -26,7 +26,7 @@ struct Issues: Codable { public struct IssuesReporter: LogReporter { - public func report(build: Any, output: ReporterOutput) throws { + public func report(build: Any, output: ReporterOutput, rootOutput: String?) throws { guard let steps = build as? BuildStep else { throw XCLogParserError.errorCreatingReport("Type not supported \(type(of: build))") } diff --git a/Sources/XCLogParser/reporter/JsonReporter.swift b/Sources/XCLogParser/reporter/JsonReporter.swift index c34c974..936ed3e 100644 --- a/Sources/XCLogParser/reporter/JsonReporter.swift +++ b/Sources/XCLogParser/reporter/JsonReporter.swift @@ -21,7 +21,7 @@ import Foundation public struct JsonReporter: LogReporter { - public func report(build: Any, output: ReporterOutput) throws { + public func report(build: Any, output: ReporterOutput, rootOutput: String?) throws { switch build { case let steps as BuildStep: try report(encodable: steps, output: output) diff --git a/Sources/XCLogParser/reporter/LogReporter.swift b/Sources/XCLogParser/reporter/LogReporter.swift index d06c186..0326db2 100644 --- a/Sources/XCLogParser/reporter/LogReporter.swift +++ b/Sources/XCLogParser/reporter/LogReporter.swift @@ -21,6 +21,6 @@ import Foundation public protocol LogReporter { - func report(build: Any, output: ReporterOutput) throws + func report(build: Any, output: ReporterOutput, rootOutput: String?) throws } diff --git a/Sources/XCLogParser/reporter/SummaryJsonReporter.swift b/Sources/XCLogParser/reporter/SummaryJsonReporter.swift index f9a756a..40c5fe2 100644 --- a/Sources/XCLogParser/reporter/SummaryJsonReporter.swift +++ b/Sources/XCLogParser/reporter/SummaryJsonReporter.swift @@ -21,7 +21,7 @@ import Foundation public struct SummaryJsonReporter: LogReporter { - public func report(build: Any, output: ReporterOutput) throws { + public func report(build: Any, output: ReporterOutput, rootOutput: String?) throws { guard let steps = build as? BuildStep else { throw XCLogParserError.errorCreatingReport("Type not supported \(type(of: build))") } diff --git a/Sources/XCLogParserApp/commands/CommonCommand.swift b/Sources/XCLogParserApp/commands/CommonCommand.swift index 7bd9c2f..d4fe581 100644 --- a/Sources/XCLogParserApp/commands/CommonCommand.swift +++ b/Sources/XCLogParserApp/commands/CommonCommand.swift @@ -64,3 +64,7 @@ let outputOption = Option( defaultValue: "", usage: "Optional. Path to which the report will be written to." + "If not specified, the report will be written to the standard output") +let rootOutputOption = Option(key: "rootOutput", + defaultValue: "", + usage: "Optional. Add the project output into the given current path" + + "i.e: myGivenPath/report.json") diff --git a/Sources/XCLogParserApp/commands/ParseCommand.swift b/Sources/XCLogParserApp/commands/ParseCommand.swift index 1f9d7f5..ad35360 100644 --- a/Sources/XCLogParserApp/commands/ParseCommand.swift +++ b/Sources/XCLogParserApp/commands/ParseCommand.swift @@ -61,7 +61,8 @@ struct ParseCommand: CommandProtocol { let actionOptions = ActionOptions(reporter: reporter, outputPath: options.output, redacted: options.redacted, - machineName: options.machineName.isEmpty ? nil : options.machineName) + machineName: options.machineName.isEmpty ? nil : options.machineName, + rootOutput: options.rootOutput) let action = Action.parse(options: actionOptions) let command = Command(logOptions: logOptions, action: action) do { @@ -85,6 +86,7 @@ struct ParseOptions: OptionsProtocol { let redacted: Bool let strictProjectName: Bool let output: String + let rootOutput: String static func create(_ logFile: String) -> (_ derivedData: String) @@ -95,10 +97,11 @@ struct ParseOptions: OptionsProtocol { -> (_ machineName: String) -> (_ redacted: Bool) -> (_ strictProjectName: Bool) - -> (_ output: String) -> ParseOptions { + -> (_ output: String) + -> (_ rootOutput: String) -> ParseOptions { return { derivedData in { projectName in { workspace in { xcodeproj in { reporter in { machineName in { redacted in { strictProjectName in { - output in + output in { rootOutput in self.init(logFile: logFile, derivedData: derivedData, projectName: projectName, @@ -108,8 +111,9 @@ struct ParseOptions: OptionsProtocol { machineName: machineName, redacted: redacted, strictProjectName: strictProjectName, - output: output) - }}}}}}}}} + output: output, + rootOutput: rootOutput) + }}}}}}}}}} } static func evaluate(_ mode: CommandMode) -> Result>> { @@ -132,6 +136,8 @@ struct ParseOptions: OptionsProtocol { <*> mode <| redactedSwitch <*> mode <| strictProjectNameSwitch <*> mode <| outputOption + <*> mode <| rootOutputOption + } func hasValidLogOptions() -> Bool { diff --git a/Tests/XCLogParserTests/IssuesReporterTests.swift b/Tests/XCLogParserTests/IssuesReporterTests.swift index 3f290bc..ca7ba17 100644 --- a/Tests/XCLogParserTests/IssuesReporterTests.swift +++ b/Tests/XCLogParserTests/IssuesReporterTests.swift @@ -28,7 +28,7 @@ class IssuesReporterTests: XCTestCase { // Build with no issues let buildStep = getBuildStep() let fakeOutput = FakeOutput() - try issuesReporter.report(build: buildStep, output: fakeOutput) + try issuesReporter.report(build: buildStep, output: fakeOutput, rootOutput: nil) guard let emptyIssues = try fakeOutput.getIssues() else { XCTFail("Issues should not be nil") return @@ -38,7 +38,7 @@ class IssuesReporterTests: XCTestCase { // Build with issues let stepWithIssues = getBuildStepWithIssues() let fakeOutputWithIssues = FakeOutput() - try issuesReporter.report(build: stepWithIssues, output: fakeOutputWithIssues) + try issuesReporter.report(build: stepWithIssues, output: fakeOutputWithIssues, rootOutput: nil) guard let issues = try fakeOutputWithIssues.getIssues() else { XCTFail("Issues should not be nil") return From 9bad543f51d1b6f8742bac514bb4abef6ef3d899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Lo=CC=81pez=20Rocha?= Date: Fri, 4 Sep 2020 16:21:27 +0200 Subject: [PATCH 2/4] Fix lint error --- Sources/XCLogParser/reporter/HtmlReporter.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/XCLogParser/reporter/HtmlReporter.swift b/Sources/XCLogParser/reporter/HtmlReporter.swift index 81d1f49..756bf4c 100644 --- a/Sources/XCLogParser/reporter/HtmlReporter.swift +++ b/Sources/XCLogParser/reporter/HtmlReporter.swift @@ -36,7 +36,10 @@ public struct HtmlReporter: LogReporter { try writeHtmlReport(for: steps, jsonString: jsonString, output: output, rootOutput: rootOutput) } - private func writeHtmlReport(for build: BuildStep, jsonString: String, output: ReporterOutput, rootOutput: String?) throws { + private func writeHtmlReport(for build: BuildStep, + jsonString: String, + output: ReporterOutput, + rootOutput: String?) throws { var path = "build/xclogparser/reports" if let rootOutput = rootOutput { path = FileOutput(path: rootOutput).path From d34055085d512f3dc0e7bb8c8b5fa1721f2c32f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Lo=CC=81pez=20Rocha?= Date: Fri, 4 Sep 2020 17:12:16 +0200 Subject: [PATCH 3/4] Fix precedence of --rootOutput --- README.md | 2 +- Sources/XCLogParser/commands/ActionOptions.swift | 4 ++-- .../XCLogParser/reporter/ChromeTracerReporter.swift | 2 +- Sources/XCLogParser/reporter/FlatJsonReporter.swift | 2 +- Sources/XCLogParser/reporter/HtmlReporter.swift | 13 ++++++------- Sources/XCLogParser/reporter/IssuesReporter.swift | 2 +- Sources/XCLogParser/reporter/JsonReporter.swift | 2 +- Sources/XCLogParser/reporter/LogReporter.swift | 2 +- .../XCLogParser/reporter/SummaryJsonReporter.swift | 2 +- 9 files changed, 15 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 8a0d96c..b822f10 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ Example output available in the [reporters](#reporters) section. | `--xcodeproj` | The path to the `xcodeproj` file if you don't know the path to the log and if the project doesn't have a `xcworkspace` file. It will generate the folder name for the project in the `DerivedData` folder using Xcode's hash algorithm and it will try to locate the latest Build Log inside that directory. | No * | | `--derived_data` | The path to the derived data folder if you are using `xcodebuild` to build your project with the `-derivedDataPath` option. | No | | `--output` | If specified, the JSON file will be written to the given path. If not defined, the command will output to the standard output. | No | - | `--rootOutput` | If specified, the HTML file will be written to the given folder. If the folder doesn't exist will be created. It works with relative home path.`~` | No | + | `--rootOutput` | If specified, the HTML file will be written to the given folder, it has precedence over `output` if the folder doesn't exist will be created. It works with relative home path.`~` | No | | `--redacted` | If specified, the username will be replaced by the word `redacted` in the file paths contained in the logs. Useful for privacy reasons but slightly decreases the performance. | No | | `--without_build_specific_info` | If specified, build specific information will be removed from the logs (for example `bolnckhlbzxpxoeyfujluasoupft` will be removed from `DerivedData/Product-bolnckhlbzxpxoeyfujluasoupft/Build` ). Useful for grouping logs by its content. | No | | `--strictProjectName` | Used in conjunction with `--project`. If specified, a stricter name matching will be done for the project name. | No | diff --git a/Sources/XCLogParser/commands/ActionOptions.swift b/Sources/XCLogParser/commands/ActionOptions.swift index 614d102..3a31bb3 100644 --- a/Sources/XCLogParser/commands/ActionOptions.swift +++ b/Sources/XCLogParser/commands/ActionOptions.swift @@ -44,14 +44,14 @@ public struct ActionOptions { public let machineName: String? /// The rootOutput will generate the HTML output in the given folder - public let rootOutput: String? + public let rootOutput: String public init(reporter: Reporter, outputPath: String, redacted: Bool, withoutBuildSpecificInformation: Bool, machineName: String? = nil, - rootOutput: String? = nil) { + rootOutput: String = "") { self.reporter = reporter self.outputPath = outputPath self.redacted = redacted diff --git a/Sources/XCLogParser/reporter/ChromeTracerReporter.swift b/Sources/XCLogParser/reporter/ChromeTracerReporter.swift index 8bd2c70..053d4b6 100644 --- a/Sources/XCLogParser/reporter/ChromeTracerReporter.swift +++ b/Sources/XCLogParser/reporter/ChromeTracerReporter.swift @@ -25,7 +25,7 @@ public struct ChromeTracerReporter: LogReporter { private let microSecondsPerSecond: Double = 1_000_000 - public func report(build: Any, output: ReporterOutput, rootOutput: String?) throws { + public func report(build: Any, output: ReporterOutput, rootOutput: String) throws { guard let steps = build as? BuildStep else { throw XCLogParserError.errorCreatingReport("Type not supported \(type(of: build))") } diff --git a/Sources/XCLogParser/reporter/FlatJsonReporter.swift b/Sources/XCLogParser/reporter/FlatJsonReporter.swift index 5078384..08c1dbd 100644 --- a/Sources/XCLogParser/reporter/FlatJsonReporter.swift +++ b/Sources/XCLogParser/reporter/FlatJsonReporter.swift @@ -21,7 +21,7 @@ import Foundation public struct FlatJsonReporter: LogReporter { - public func report(build: Any, output: ReporterOutput, rootOutput: String?) throws { + public func report(build: Any, output: ReporterOutput, rootOutput: String) throws { guard let steps = build as? BuildStep else { throw XCLogParserError.errorCreatingReport("Type not supported \(type(of: build))") } diff --git a/Sources/XCLogParser/reporter/HtmlReporter.swift b/Sources/XCLogParser/reporter/HtmlReporter.swift index 756bf4c..fc17b39 100644 --- a/Sources/XCLogParser/reporter/HtmlReporter.swift +++ b/Sources/XCLogParser/reporter/HtmlReporter.swift @@ -23,7 +23,7 @@ import Foundation /// It uses the html and javascript files from the Resources folder as templates public struct HtmlReporter: LogReporter { - public func report(build: Any, output: ReporterOutput, rootOutput: String?) throws { + public func report(build: Any, output: ReporterOutput, rootOutput: String) throws { guard let steps = build as? BuildStep else { throw XCLogParserError.errorCreatingReport("Type not supported \(type(of: build))") } @@ -39,17 +39,17 @@ public struct HtmlReporter: LogReporter { private func writeHtmlReport(for build: BuildStep, jsonString: String, output: ReporterOutput, - rootOutput: String?) throws { + rootOutput: String) throws { var path = "build/xclogparser/reports" - if let rootOutput = rootOutput { - path = FileOutput(path: rootOutput).path - } if let output = output as? FileOutput { path = output.path } + if !rootOutput.isEmpty { + path = FileOutput(path: rootOutput).path + } let fileManager = FileManager.default var buildDir = "\(path)/\(dirFor(build: build))" - if rootOutput != nil { + if !rootOutput.isEmpty { buildDir = path } try fileManager.createDirectory( @@ -75,5 +75,4 @@ public struct HtmlReporter: LogReporter { dateFormatter.dateFormat = "YYYYMMddHHmmss" return dateFormatter.string(from: Date(timeIntervalSince1970: Double(build.startTimestamp))) } - } diff --git a/Sources/XCLogParser/reporter/IssuesReporter.swift b/Sources/XCLogParser/reporter/IssuesReporter.swift index 52adf90..9bd4b68 100644 --- a/Sources/XCLogParser/reporter/IssuesReporter.swift +++ b/Sources/XCLogParser/reporter/IssuesReporter.swift @@ -26,7 +26,7 @@ struct Issues: Codable { public struct IssuesReporter: LogReporter { - public func report(build: Any, output: ReporterOutput, rootOutput: String?) throws { + public func report(build: Any, output: ReporterOutput, rootOutput: String) throws { guard let steps = build as? BuildStep else { throw XCLogParserError.errorCreatingReport("Type not supported \(type(of: build))") } diff --git a/Sources/XCLogParser/reporter/JsonReporter.swift b/Sources/XCLogParser/reporter/JsonReporter.swift index 936ed3e..e5957a2 100644 --- a/Sources/XCLogParser/reporter/JsonReporter.swift +++ b/Sources/XCLogParser/reporter/JsonReporter.swift @@ -21,7 +21,7 @@ import Foundation public struct JsonReporter: LogReporter { - public func report(build: Any, output: ReporterOutput, rootOutput: String?) throws { + public func report(build: Any, output: ReporterOutput, rootOutput: String) throws { switch build { case let steps as BuildStep: try report(encodable: steps, output: output) diff --git a/Sources/XCLogParser/reporter/LogReporter.swift b/Sources/XCLogParser/reporter/LogReporter.swift index 0326db2..958f215 100644 --- a/Sources/XCLogParser/reporter/LogReporter.swift +++ b/Sources/XCLogParser/reporter/LogReporter.swift @@ -21,6 +21,6 @@ import Foundation public protocol LogReporter { - func report(build: Any, output: ReporterOutput, rootOutput: String?) throws + func report(build: Any, output: ReporterOutput, rootOutput: String) throws } diff --git a/Sources/XCLogParser/reporter/SummaryJsonReporter.swift b/Sources/XCLogParser/reporter/SummaryJsonReporter.swift index 40c5fe2..06e9c0e 100644 --- a/Sources/XCLogParser/reporter/SummaryJsonReporter.swift +++ b/Sources/XCLogParser/reporter/SummaryJsonReporter.swift @@ -21,7 +21,7 @@ import Foundation public struct SummaryJsonReporter: LogReporter { - public func report(build: Any, output: ReporterOutput, rootOutput: String?) throws { + public func report(build: Any, output: ReporterOutput, rootOutput: String) throws { guard let steps = build as? BuildStep else { throw XCLogParserError.errorCreatingReport("Type not supported \(type(of: build))") } From aed44e1637187caecca552585c1678dc54695057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Lo=CC=81pez=20Rocha?= Date: Fri, 4 Sep 2020 17:21:41 +0200 Subject: [PATCH 4/4] Fix tests --- Tests/XCLogParserTests/IssuesReporterTests.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/XCLogParserTests/IssuesReporterTests.swift b/Tests/XCLogParserTests/IssuesReporterTests.swift index ca7ba17..c80f169 100644 --- a/Tests/XCLogParserTests/IssuesReporterTests.swift +++ b/Tests/XCLogParserTests/IssuesReporterTests.swift @@ -28,7 +28,7 @@ class IssuesReporterTests: XCTestCase { // Build with no issues let buildStep = getBuildStep() let fakeOutput = FakeOutput() - try issuesReporter.report(build: buildStep, output: fakeOutput, rootOutput: nil) + try issuesReporter.report(build: buildStep, output: fakeOutput, rootOutput: "") guard let emptyIssues = try fakeOutput.getIssues() else { XCTFail("Issues should not be nil") return @@ -38,7 +38,7 @@ class IssuesReporterTests: XCTestCase { // Build with issues let stepWithIssues = getBuildStepWithIssues() let fakeOutputWithIssues = FakeOutput() - try issuesReporter.report(build: stepWithIssues, output: fakeOutputWithIssues, rootOutput: nil) + try issuesReporter.report(build: stepWithIssues, output: fakeOutputWithIssues, rootOutput: "") guard let issues = try fakeOutputWithIssues.getIssues() else { XCTFail("Issues should not be nil") return