Skip to content

Commit

Permalink
Add validation error support
Browse files Browse the repository at this point in the history
Signed-off-by: Bartosz Polaczyk <polac24@gmail.com>
  • Loading branch information
polac24 committed Jan 25, 2022
1 parent a46e94c commit 5ac2d21
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sources/XCLogParser/activityparser/ActivityParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ public class ActivityParser {
}
switch token {
case .string(let string):
return string
return string.trimmingCharacters(in: .whitespacesAndNewlines)
case .null:
return ""
default:
Expand Down
3 changes: 2 additions & 1 deletion Sources/XCLogParser/extensions/ArrayExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ extension Array where Element: Notice {
$0.type == .clangError ||
$0.type == .linkerError ||
$0.type == .packageLoadingError ||
$0.type == .scriptPhaseError
$0.type == .scriptPhaseError ||
$0.type == .failedCommandError
}
}

Expand Down
11 changes: 11 additions & 0 deletions Sources/XCLogParser/parser/BuildStep.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ public enum DetailStepType: String, Encodable {
/// For steps that are not a detail step
case none

/// Validate watch, extensions binaries
case validateEmbeddedBinary

/// Validate app
case validate

// swiftlint:disable:next cyclomatic_complexity
public static func getDetailType(signature: String) -> DetailStepType {
switch signature {
Expand Down Expand Up @@ -118,7 +124,12 @@ public enum DetailStepType: String, Encodable {
return .swiftAggregatedCompilation
case Prefix("PrecompileSwiftBridgingHeader "):
return .precompileBridgingHeader
case Prefix("ValidateEmbeddedBinary "):
return .validateEmbeddedBinary
case Prefix("Validate "):
return .validate
default:
print(signature)
return .other
}
}
Expand Down
5 changes: 5 additions & 0 deletions Sources/XCLogParser/parser/NoticeType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public enum NoticeType: String, Codable {
/// Error running a Build Phase's script
case scriptPhaseError

/// Failed command error (e.g. ValidateEmbeddedBinary, CodeSign)
case failedCommandError

// swiftlint:disable:next cyclomatic_complexity
public static func fromTitle(_ title: String) -> NoticeType? {
switch title {
Expand Down Expand Up @@ -89,6 +92,8 @@ public enum NoticeType: String, Codable {
return .scriptPhaseError
case Prefix("error: Swiftc"):
return .swiftError
case Suffix("failed with a nonzero exit code"):
return .failedCommandError
default:
return .note
}
Expand Down

0 comments on commit 5ac2d21

Please sign in to comment.