Skip to content

Commit

Permalink
Add PrecompileModule Capture Group
Browse files Browse the repository at this point in the history
  • Loading branch information
cpisciotta committed Jan 20, 2025
1 parent a15d378 commit 8719ae2
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Sources/XcbeautifyLib/CaptureGroups.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,20 @@ struct PhaseScriptExecutionCaptureGroup: CaptureGroup {
}
}

struct PrecompileModuleCaptureGroup: CaptureGroup {
static let outputType: OutputType = .task

static let regex = XCRegex(pattern: #"^PrecompileModule (.*\.scan)$"#)

let path: String

init?(groups: [String]) {
assert(groups.count == 1)
guard let path = groups[safe: 0] else { return nil }
self.path = path
}
}

struct ProcessPchCaptureGroup: CaptureGroup {
static let outputType: OutputType = .task

Expand Down
2 changes: 2 additions & 0 deletions Sources/XcbeautifyLib/Formatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ package struct Formatter {
return renderer.formatPhaseSuccess(group: group)
case let group as PodsErrorCaptureGroup:
return renderer.formatError(group: group)
case let group as PrecompileModuleCaptureGroup:
return renderer.formatPrecompileModule(group: group)
case let group as PreprocessCaptureGroup:
return renderer.formatPreprocess(group: group)
case let group as ProcessInfoPlistCaptureGroup:
Expand Down
1 change: 1 addition & 0 deletions Sources/XcbeautifyLib/Parser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ package final class Parser {
TestCaseMeasuredCaptureGroup.self,
PhaseSuccessCaptureGroup.self,
PhaseScriptExecutionCaptureGroup.self,
PrecompileModuleCaptureGroup.self,
ProcessPchCaptureGroup.self,
ProcessPchCommandCaptureGroup.self,
PreprocessCaptureGroup.self,
Expand Down
5 changes: 5 additions & 0 deletions Sources/XcbeautifyLib/Renderers/OutputRendering.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ protocol OutputRendering {
func formatParallelTestSuiteStarted(group: ParallelTestSuiteStartedCaptureGroup) -> String
func formatPhaseScriptExecution(group: PhaseScriptExecutionCaptureGroup) -> String
func formatPhaseSuccess(group: PhaseSuccessCaptureGroup) -> String
func formatPrecompileModule(group: PrecompileModuleCaptureGroup) -> String?
func formatPreprocess(group: PreprocessCaptureGroup) -> String
func formatProcessInfoPlist(group: ProcessInfoPlistCaptureGroup) -> String
func formatProcessPch(group: ProcessPchCaptureGroup) -> String
Expand Down Expand Up @@ -280,6 +281,10 @@ extension OutputRendering {
return colored ? "\(phase) Succeeded".s.Bold.f.Green : "\(phase) Succeeded"
}

func formatPrecompileModule(group: PrecompileModuleCaptureGroup) -> String? {
nil
}

func formatPreprocess(group: PreprocessCaptureGroup) -> String {
let target = group.target
let file = group.file
Expand Down
7 changes: 7 additions & 0 deletions Tests/XcbeautifyLibTests/CaptureGroupTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ final class CaptureGroupTests: XCTestCase {
XCTAssertNotNil(MkDirCaptureGroup.regex.captureGroups(for: input))
}

func testPrecompileModule() throws {
let input = "PrecompileModule /Users/Some/Random-Path/_To/A/Build/Intermediates.noindex/ExplicitPrecompileModules/file-ABC123.scan"
let groups = try XCTUnwrap(PrecompileModuleCaptureGroup.regex.captureGroups(for: input))
XCTAssertEqual(groups.count, 1)
XCTAssertEqual(groups[0], "/Users/Some/Random-Path/_To/A/Build/Intermediates.noindex/ExplicitPrecompileModules/file-ABC123.scan")
}

func testUnindentedShellCommand() throws {
let input = #"/Applications/Xcode-16.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -Xlinker -reproducible -target arm64-apple-macos14.0 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -O0 -L/Backyard-Birds/Build/Intermediates.noindex/EagerLinkingTBDs/Debug -L/Backyard-Birds/Build/Products/Debug -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F/Backyard-Birds/Build/Intermediates.noindex/EagerLinkingTBDs/Debug -F/Backyard-Birds/Build/Products/Debug/PackageFrameworks -F/Backyard-Birds/Build/Products/Debug -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -iframework /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -filelist /Backyard-Birds/Build/Intermediates.noindex/BackyardBirdsData.build/Debug/BackyardBirdsData\ product.build/Objects-normal/arm64/BackyardBirdsData.LinkFileList -install_name @rpath/BackyardBirdsData.framework/Versions/A/BackyardBirdsData -Xlinker -rpath -Xlinker /Backyard-Birds/Build/Products/Debug/PackageFrameworks -Xlinker -object_path_lto -Xlinker /Backyard-Birds/Build/Intermediates.noindex/BackyardBirdsData.build/Debug/BackyardBirdsData\ product.build/Objects-normal/arm64/BackyardBirdsData_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -L/usr/lib/swift -Wl,-no_warn_duplicate_libraries -Xlinker -dependency_info -Xlinker /Backyard-Birds/Build/Intermediates.noindex/BackyardBirdsData.build/Debug/BackyardBirdsData\ product.build/Objects-normal/arm64/BackyardBirdsData_dependency_info.dat -o /Backyard-Birds/Build/Intermediates.noindex/BackyardBirdsData.build/Debug/BackyardBirdsData\ product.build/Objects-normal/arm64/Binary/BackyardBirdsData -Xlinker -add_ast_path -Xlinker /Backyard-Birds/Build/Intermediates.noindex/BackyardBirdsData.build/Debug/BackyardBirdsData.build/Objects-normal/arm64/BackyardBirdsData.swiftmodule"#
let groups = try XCTUnwrap(NonPCHClangCommandCaptureGroup.regex.captureGroups(for: input))
Expand Down
5 changes: 5 additions & 0 deletions Tests/XcbeautifyLibTests/ParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,9 @@ final class ParserTests: XCTestCase {
XCTAssertEqual(resultFailed.time, "0.001")
XCTAssertEqual(resultFailed.testCase, "exampleFalse")
}

func tesPrecompileModule() throws {
let input = try XCTUnwrap(parser.parse(line: "PrecompileModule /Users/Some/Random-Path/_To/A/Build/Intermediates.noindex/ExplicitPrecompileModules/file-ABC123.scan") as? PrecompileModuleCaptureGroup)
XCTAssertEqual(input.path, "/Users/Some/Random-Path/_To/A/Build/Intermediates.noindex/ExplicitPrecompileModules/file-ABC123.scan")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,11 @@ final class AzureDevOpsPipelinesRendererTests: XCTestCase {
XCTAssertEqual(logFormatted(input), output)
}

func testPrecompileModule() {
let input = "PrecompileModule /Users/Some/Random-Path/_To/A/Build/Intermediates.noindex/ExplicitPrecompileModules/file-ABC123.scan"
XCTAssertNil(logFormatted(input))
}

func testPreprocess() {
let input = "Preprocess /Example/Example/Something.m normal arm64 (in target 'SomeTarget' from project 'SomeProject')"
let output = "[SomeTarget] Preprocess Something.m"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ final class GitHubActionsRendererTests: XCTestCase {
XCTAssertEqual(logFormatted(input), output)
}

func testPrecompileModule() {
let input = "PrecompileModule /Users/Some/Random-Path/_To/A/Build/Intermediates.noindex/ExplicitPrecompileModules/file-ABC123.scan"
XCTAssertNil(logFormatted(input))
}

func testPreprocess() {
let input = "Preprocess /Example/Example/Something.m normal arm64 (in target 'SomeTarget' from project 'SomeProject')"
let output = "[SomeTarget] Preprocess Something.m"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,11 @@ final class TeamCityRendererTests: XCTestCase {
XCTAssertEqual(noColoredFormatted(input), output)
}

func testPrecompileModule() {
let input = "PrecompileModule /Users/Some/Random-Path/_To/A/Build/Intermediates.noindex/ExplicitPrecompileModules/file-ABC123.scan"
XCTAssertNil(noColoredFormatted(input))
}

func testPreprocess() {
let input = "Preprocess /Example/Example/Something.m normal arm64 (in target 'SomeTarget' from project 'SomeProject')"
let output = "[SomeTarget] Preprocess Something.m"
Expand Down

0 comments on commit 8719ae2

Please sign in to comment.