From c4876c5ecd95a5b11a0a89e0981e3daebb76288f Mon Sep 17 00:00:00 2001 From: Charles Pisciotta Date: Sat, 16 Nov 2024 11:16:35 -0500 Subject: [PATCH 1/5] Escape Regular Expressions --- Sources/XcbeautifyLib/CaptureGroups.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/XcbeautifyLib/CaptureGroups.swift b/Sources/XcbeautifyLib/CaptureGroups.swift index f0cd2d16..f6df306e 100644 --- a/Sources/XcbeautifyLib/CaptureGroups.swift +++ b/Sources/XcbeautifyLib/CaptureGroups.swift @@ -199,7 +199,7 @@ struct CodesignCaptureGroup: CaptureGroup { /// Regular expression captured groups: /// $1 = file - static let regex = XCRegex(pattern: #"^CodeSign\s(((?!.framework/Versions/A)(?:\ |[^ ]))*?)( \(in target '.*' from project '.*' at path '.*'\))?$"#) + static let regex = XCRegex(pattern: #"^CodeSign\s(((?!.framework\/Versions\/A)(?:\ |[^ ]))*?)( \(in target '.*' from project '.*' at path '.*'\))?$"#) let file: String @@ -215,7 +215,7 @@ struct CodesignFrameworkCaptureGroup: CaptureGroup { /// Regular expression captured groups: /// $1 = file - static let regex = XCRegex(pattern: #"^CodeSign\s((?:\ |[^ ])*.framework)\/Versions/A"#) + static let regex = XCRegex(pattern: #"^CodeSign\s((?:\ |[^ ])*.framework)\/Versions\/A"#) let frameworkPath: String @@ -912,7 +912,7 @@ struct ParallelTestCaseFailedCaptureGroup: CaptureGroup { /// $2 = test case /// $3 = installed app file and ID (e.g. "MyApp.app (12345)"), process (e.g. "xctest (12345)"), or device (e.g. "iPhone X") /// $4 = time - static let regex = XCRegex(pattern: #"^Test\s+case\s+'(.*)[\./](.*)\(\)'\s+failed\s+on\s+'(.*)'\s+\((\d*\.(.*){3})\s+seconds\)"#) + static let regex = XCRegex(pattern: #"^Test\s+case\s+'(.*)[\.\/](.*)\(\)'\s+failed\s+on\s+'(.*)'\s+\((\d*\.(.*){3})\s+seconds\)"#) let suite: String let testCase: String @@ -1391,7 +1391,7 @@ struct DuplicateLocalizedStringKeyCaptureGroup: CaptureGroup { /// Regular expresion captured groups: /// $1 = warning message. - static let regex = XCRegex(pattern: #"^[\d\s-:]+ --- WARNING: (Key ".*" used with multiple values. Value ".*" kept. Value ".*" ignored.)$"#) + static let regex = XCRegex(pattern: #"^[\d -:]+ --- WARNING: (Key ".*" used with multiple values. Value ".*" kept. Value ".*" ignored.)$"#) let warningMessage: String @@ -1660,7 +1660,7 @@ struct ModuleIncludesErrorCaptureGroup: ErrorCaptureGroup { /// Regular expression captured groups: /// $1 = error reason - static let regex = XCRegex(pattern: #"^\:.*?:.*?:\s(?:fatal\s)?(error:\s.*)$/"#) + static let regex = XCRegex(pattern: #"^\:.*?:.*?:\s(?:fatal\s)?(error:\s.*)$\/"#) let wholeError: String From 17d8ab42ddec0189bc022a0c49d1d6cf70011ed6 Mon Sep 17 00:00:00 2001 From: Charles Pisciotta Date: Sat, 16 Nov 2024 11:24:19 -0500 Subject: [PATCH 2/5] Update SwiftDriverJobDiscoveryCompilingCaptureGroup --- Sources/XcbeautifyLib/CaptureGroups.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/XcbeautifyLib/CaptureGroups.swift b/Sources/XcbeautifyLib/CaptureGroups.swift index f6df306e..5e82edcd 100644 --- a/Sources/XcbeautifyLib/CaptureGroups.swift +++ b/Sources/XcbeautifyLib/CaptureGroups.swift @@ -1843,7 +1843,7 @@ struct SwiftDriverJobDiscoveryCompilingCaptureGroup: CaptureGroup { // $3 = filenames // $4 = target // $5 = project - static let regex = XCRegex(pattern: #"^SwiftDriverJobDiscovery (\S+) (\S+) Compiling ((?:\S|(?>, )|(?<=\\) )+) \(in target '(.*)' from project '(.*)'\)"#) + static let regex = XCRegex(pattern: #"^SwiftDriverJobDiscovery (\S+) (\S+) Compiling (.*) \(in target '(.*)' from project '(.*)'\)"#) let state: String // Currently, the only expected/known value is `normal` let architecture: String From ba38bbbea58e251e3fe04bd9a3d6b58f198f7432 Mon Sep 17 00:00:00 2001 From: Charles Pisciotta Date: Sat, 16 Nov 2024 11:25:45 -0500 Subject: [PATCH 3/5] Update SwiftCompileCaptureGroup --- Sources/XcbeautifyLib/CaptureGroups.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/XcbeautifyLib/CaptureGroups.swift b/Sources/XcbeautifyLib/CaptureGroups.swift index 5e82edcd..eadb80f3 100644 --- a/Sources/XcbeautifyLib/CaptureGroups.swift +++ b/Sources/XcbeautifyLib/CaptureGroups.swift @@ -271,7 +271,7 @@ struct SwiftCompileCaptureGroup: CompileFileCaptureGroup { /// $1 = file path /// $2 = target /// $3 = project - static let regex = XCRegex(pattern: #"^SwiftCompile \w+ \w+ ((?:\S|(?<=\\) )+) \(in target '(.*)' from project '(.*)'\)$"#) + static let regex = XCRegex(pattern: #"^SwiftCompile \w+ \w+ ((?!Compiling\\ ).*) \(in target '(.*)' from project '(.*)'\)$"#) let filePath: String let filename: String From b6132d92ad2dac60b6174315a34cf5d231386f80 Mon Sep 17 00:00:00 2001 From: Charles Pisciotta Date: Sat, 16 Nov 2024 11:35:23 -0500 Subject: [PATCH 4/5] Update CompileStoryboardCaptureGroup --- Sources/XcbeautifyLib/CaptureGroups.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/XcbeautifyLib/CaptureGroups.swift b/Sources/XcbeautifyLib/CaptureGroups.swift index eadb80f3..5bacb3d9 100644 --- a/Sources/XcbeautifyLib/CaptureGroups.swift +++ b/Sources/XcbeautifyLib/CaptureGroups.swift @@ -362,8 +362,8 @@ struct CompileStoryboardCaptureGroup: CompileFileCaptureGroup { struct CopyFilesCaptureGroup: CaptureGroup { static let outputType: OutputType = .task - // ((?:\S|(?<=\\) )+) --> Match any non-whitespace character OR any escaped space (space in filename) - static let regex = XCRegex(pattern: #"^Copy ((?:\S|(?<=\\) )+) ((?:\S|(?<=\\) )+) \(in target '(.*)' from project '.*'\)$"#) + // ((?:\S|(?:\\ ))+) --> Match any non-whitespace character OR any escaped space (space in filename) + static let regex = XCRegex(pattern: #"^Copy ((?:\S|(?:\\ ))+) ((?:\S|(?:\\ ))+) \(in target '(.*)' from project '.*'\)$"#) let firstFilePath: String let firstFilename: String From 40c8dc5e1bac7434a9d3dfc7f5345c6bee4aec29 Mon Sep 17 00:00:00 2001 From: Charles Pisciotta Date: Sat, 16 Nov 2024 11:52:10 -0500 Subject: [PATCH 5/5] Update ProcessPchCommandCaptureGroup --- Sources/XcbeautifyLib/CaptureGroups.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/XcbeautifyLib/CaptureGroups.swift b/Sources/XcbeautifyLib/CaptureGroups.swift index 5bacb3d9..a0354ee3 100644 --- a/Sources/XcbeautifyLib/CaptureGroups.swift +++ b/Sources/XcbeautifyLib/CaptureGroups.swift @@ -1061,7 +1061,7 @@ struct ProcessPchCommandCaptureGroup: CaptureGroup { /// Regular expression captured groups: /// $1 file path - static let regex = XCRegex(pattern: #"^\s*.*\/usr\/bin\/clang\s.*\s\-c\s(.*?)(?