Skip to content

Commit

Permalink
Move beautify implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
cpisciotta committed Nov 24, 2023
1 parent 3895fdd commit 477bfee
Show file tree
Hide file tree
Showing 2 changed files with 175 additions and 187 deletions.
186 changes: 0 additions & 186 deletions Sources/XcbeautifyLib/Renderers/OutputRendering.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import Foundation
protocol OutputRendering {
var colored: Bool { get }

func beautify(captureGroup: CaptureGroup, line: String, additionalLines: @escaping () -> (String?)) -> String?

func format(testSummary: TestSummary) -> String

func format(line: String, command: String, pattern: Pattern, arguments: String) -> String?
Expand Down Expand Up @@ -75,190 +73,6 @@ protocol OutputRendering {
func formatWriteFile(group: WriteFileCaptureGroup) -> String?
}

extension OutputRendering {
func beautify(
captureGroup: CaptureGroup,
line: String,
additionalLines: @escaping () -> (String?)
) -> String? {
switch captureGroup {
case let group as AggregateTargetCaptureGroup:
return formatTargetCommand(command: "Aggregate", group: group)
case let group as AnalyzeCaptureGroup:
return formatAnalyze(group: group)
case let group as AnalyzeTargetCaptureGroup:
return formatTargetCommand(command: "Analyze", group: group)
case let group as BuildTargetCaptureGroup:
return formatTargetCommand(command: "Build", group: group)
case _ as CheckDependenciesCaptureGroup:
return format(line: line, command: "Check Dependencies", pattern: .checkDependencies, arguments: "")
case let group as CheckDependenciesErrorsCaptureGroup:
return formatError(group: group)
case let group as ClangErrorCaptureGroup:
return formatError(group: group)
case let group as CleanRemoveCaptureGroup:
return formatCleanRemove(group: group)
case let group as CleanTargetCaptureGroup:
return formatTargetCommand(command: "Clean", group: group)
case let group as CodesignCaptureGroup:
return formatCodeSign(group: group)
case let group as CodesignFrameworkCaptureGroup:
return formatCodeSignFramework(group: group)
case let group as CompileCaptureGroup:
return formatCompile(group: group)
case let group as CompileCommandCaptureGroup:
return formatCompileCommand(group: group)
case let group as CompileErrorCaptureGroup:
return formatCompileError(group: group, additionalLines: additionalLines)
case let group as CompileStoryboardCaptureGroup:
return formatCompile(group: group)
case let group as CompileWarningCaptureGroup:
return formatCompileWarning(group: group, additionalLines: additionalLines)
case let group as CompileXibCaptureGroup:
return formatCompile(group: group)
case let group as CopyHeaderCaptureGroup:
return formatCopy(group: group)
case let group as CopyPlistCaptureGroup:
return formatCopy(group: group)
case let group as CopyStringsCaptureGroup:
return formatCopy(group: group)
case let group as CpresourceCaptureGroup:
return formatCopy(group: group)
case let group as CursorCaptureGroup:
return formatCursor(group: group)
case let group as DuplicateLocalizedStringKeyCaptureGroup:
return formatDuplicateLocalizedStringKey(group: group)
case let group as ExecutedWithoutSkippedCaptureGroup:
return formatExecutedWithoutSkipped(group: group)
case let group as ExecutedWithSkippedCaptureGroup:
return formatExecutedWithSkipped(group: group)
case let group as FailingTestCaptureGroup:
return formatFailingTest(group: group)
case let group as FatalErrorCaptureGroup:
return formatError(group: group)
case let group as FileMissingErrorCaptureGroup:
return formatFileMissingError(group: group)
case let group as GenerateCoverageDataCaptureGroup:
return formatGenerateCoverageData(group: group)
case let group as GeneratedCoverageReportCaptureGroup:
return formatCoverageReport(group: group)
case let group as GenerateDSYMCaptureGroup:
return formatGenerateDsym(group: group)
case let group as GenericWarningCaptureGroup:
return formatWarning(group: group)
case let group as LDErrorCaptureGroup:
return formatError(group: group)
case let group as LDWarningCaptureGroup:
return formatLdWarning(group: group)
case let group as LibtoolCaptureGroup:
return formatLibtool(group: group)
case let group as LinkerDuplicateSymbolsCaptureGroup:
return formatLinkerDuplicateSymbolsError(group: group)
case let group as LinkerDuplicateSymbolsLocationCaptureGroup:
return formatLinkerDuplicateSymbolsLocation(group: group)
case let group as LinkerUndefinedSymbolLocationCaptureGroup:
return formatLinkerUndefinedSymbolLocation(group: group)
case let group as LinkerUndefinedSymbolsCaptureGroup:
return formatLinkerUndefinedSymbolsError(group: group)
case let group as LinkingCaptureGroup:
return formatLinking(group: group)
case let group as ModuleIncludesErrorCaptureGroup:
return formatError(group: group)
case let group as NoCertificateCaptureGroup:
return formatError(group: group)
case let group as PackageCheckingOutCaptureGroup:
return formatPackageCheckingOut(group: group)
case let group as PackageFetchingCaptureGroup:
return formatPackageFetching(group: group)
case let group as PackageGraphResolvedItemCaptureGroup:
return formatPackageItem(group: group)
case _ as PackageGraphResolvingEndedCaptureGroup:
return formatPackageEnd()
case _ as PackageGraphResolvingStartCaptureGroup:
return formatPackageStart()
case let group as PackageUpdatingCaptureGroup:
return formatPackageUpdating(group: group)
case let group as ParallelTestCaseAppKitPassedCaptureGroup:
return formatParallelTestCaseAppKitPassed(group: group)
case let group as ParallelTestCaseFailedCaptureGroup:
return formatParallelTestCaseFailed(group: group)
case let group as ParallelTestCasePassedCaptureGroup:
return formatParallelTestCasePassed(group: group)
case let group as ParallelTestingFailedCaptureGroup:
return formatParallelTestingFailed(line: line, group: group)
case let group as ParallelTestingPassedCaptureGroup:
return formatParallelTestingPassed(line: line, group: group)
case let group as ParallelTestingStartedCaptureGroup:
return formatParallelTestingStarted(line: line, group: group)
case let group as ParallelTestSuiteStartedCaptureGroup:
return formatParallelTestSuiteStarted(group: group)
case let group as PbxcpCaptureGroup:
return formatCopy(group: group)
case let group as PhaseScriptExecutionCaptureGroup:
return formatPhaseScriptExecution(group: group)
case let group as PhaseSuccessCaptureGroup:
return formatPhaseSuccess(group: group)
case let group as PodsErrorCaptureGroup:
return formatError(group: group)
case _ as PreprocessCaptureGroup:
// return format(line: line, command: "Preprocessing", pattern: pattern, arguments: "$1")
// FIXME
return nil
case let group as ProcessInfoPlistCaptureGroup:
return formatProcessInfoPlist(group: group)
case let group as ProcessPchCaptureGroup:
return formatProcessPch(group: group)
case let group as ProcessPchCommandCaptureGroup:
return formatProcessPchCommand(group: group)
case let group as ProvisioningProfileRequiredCaptureGroup:
return formatError(group: group)
case let group as RestartingTestCaptureGroup:
return formatRestartingTest(line: line, group: group)
case let group as ShellCommandCaptureGroup:
return formatShellCommand(group: group)
case _ as SymbolReferencedFromCaptureGroup:
return formatCompleteError(line: line)
case let group as TestCaseMeasuredCaptureGroup:
return formatTestCaseMeasured(group: group)
case let group as TestCasePassedCaptureGroup:
return formatTestCasePassed(group: group)
case let group as TestCasePendingCaptureGroup:
return formatTestCasePending(group: group)
case let group as TestCaseStartedCaptureGroup:
return formatTestCasesStarted(group: group)
case let group as TestsRunCompletionCaptureGroup:
return formatTestsRunCompletion(group: group)
case let group as TestSuiteAllTestsFailedCaptureGroup:
return formatTestSuiteAllTestsFailed(group: group)
case let group as TestSuiteAllTestsPassedCaptureGroup:
return formatTestSuiteAllTestsPassed(group: group)
case let group as TestSuiteStartCaptureGroup:
return formatTestSuiteStart(group: group)
case let group as TestSuiteStartedCaptureGroup:
return formatTestSuiteStarted(group: group)
case let group as TIFFutilCaptureGroup:
return formatTIFFUtil(group: group)
case let group as TouchCaptureGroup:
return formatTouch(group: group)
case let group as UIFailingTestCaptureGroup:
return formatUIFailingTest(group: group)
case _ as UndefinedSymbolLocationCaptureGroup:
return formatCompleteWarning(line: line)
case let group as WillNotBeCodeSignedCaptureGroup:
return formatWillNotBeCodesignWarning(group: group)
case let group as WriteAuxiliaryFilesCaptureGroup:
return formatWriteAuxiliaryFiles(group: group)
case let group as WriteFileCaptureGroup:
return formatWriteFile(group: group)
case let group as XcodebuildErrorCaptureGroup:
return formatError(group: group)
default:
assertionFailure()
return nil
}
}
}

extension OutputRendering {

func format(line: String, command: String, pattern: Pattern, arguments: String) -> String? {
Expand Down
Loading

0 comments on commit 477bfee

Please sign in to comment.