Skip to content

Commit

Permalink
Merge pull request #42 from davidahouse/house/41/xcode-14-schema
Browse files Browse the repository at this point in the history
♻️ Schema updates for Xcode 14
  • Loading branch information
davidahouse authored Oct 14, 2022
2 parents 2fe24c2 + 2d8fdd8 commit 21ba268
Show file tree
Hide file tree
Showing 60 changed files with 1,062 additions and 486 deletions.
29 changes: 0 additions & 29 deletions Sources/XCResultKit/ActionTestFailureSummary.swift

This file was deleted.

30 changes: 30 additions & 0 deletions Sources/XCResultKit/Schema/ActionAbstractTestSummary.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// File.swift
//
//
// Created by David House on 9/17/22.
//

import Foundation

//- ActionAbstractTestSummary
// * Kind: object
// * Properties:
// + name: String?

public struct ActionAbstractTestSummary: XCResultObject, Encodable {
public let name: String?

public init?(_ json: [String: AnyObject]) {
name = xcOptional(element: "name", from: json)
}

enum CodingKeys: String, CodingKey {
case name
}

public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(name, forKey: .name)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public struct ActionRecord: XCResultObject {
public let runDestination: ActionRunDestinationRecord
public let buildResult: ActionResult
public let actionResult: ActionResult
public let testPlanName: String?

public init?(_ json: [String: AnyObject]) {

Expand All @@ -39,6 +40,7 @@ public struct ActionRecord: XCResultObject {
startedTime = try xcRequired(element: "startedTime", from: json)
endedTime = try xcRequired(element: "endedTime", from: json)
runDestination = try xcRequired(element: "runDestination", from: json)
testPlanName = xcOptional(element: "testPlanName", from: json)
} catch {
logError("Error parsing ActionRecord: \(error.localizedDescription)")
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public struct ActionResult: XCResultObject {
public let logRef: Reference?
public let testsRef: Reference?
public let diagnosticsRef: Reference?
public let consoleLogRef: Reference?

public init?(_ json: [String: AnyObject]) {

Expand All @@ -42,6 +43,7 @@ public struct ActionResult: XCResultObject {
logRef = xcOptional(element: "logRef", from: json)
testsRef = xcOptional(element: "testsRef", from: json)
diagnosticsRef = xcOptional(element: "diagnosticsRef", from: json)
consoleLogRef = xcOptional(element: "consoleLogRef", from: json)
} catch {
logError("Error parsing ActionResult: \(error.localizedDescription)")
return nil
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public struct ActionTestActivitySummary: XCResultObject {
public let finish: Date?
public let attachments: [ActionTestAttachment]
public let subactivities: [ActionTestActivitySummary]
public let failureSummaryIDs: [String]
public let expectedFailureIDs: [String]

public init?(_ json: [String: AnyObject]) {
do {
Expand All @@ -38,6 +40,8 @@ public struct ActionTestActivitySummary: XCResultObject {
.ofType(ActionTestAttachment.self)
subactivities = xcArray(element: "subactivities", from: json)
.ofType(ActionTestActivitySummary.self)
failureSummaryIDs = xcArray(element: "failureSummaryIDs", from: json).ofType(String.self)
expectedFailureIDs = xcArray(element: "expectedFailureIDs", from: json).ofType(String.self)
} catch {
logError("Error parsing ActionTestActivitySummary: \(error.localizedDescription)")
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import Foundation
public struct ActionTestAttachment: XCResultObject {
public let uniformTypeIdentifier: String
public let name: String?
public let uuid: String?
public let timestamp: Date?
public let userInfo: SortedKeyValueArray?
public let lifetime: String
public let inActivityIdentifier: Int
public let filename: String?
Expand All @@ -33,8 +35,10 @@ public struct ActionTestAttachment: XCResultObject {
do {
uniformTypeIdentifier = try xcRequired(element: "uniformTypeIdentifier", from: json)
name = xcOptional(element: "name", from: json)
uuid = xcOptional(element: "uuid", from: json)
timestamp = xcOptional(element: "timestamp", from: json)
lifetime = try xcRequired(element: "lifetime", from: json)
userInfo = xcOptional(element: "userInfo", from: json)
inActivityIdentifier = try xcRequired(element: "inActivityIdentifier", from: json)
filename = xcOptional(element: "filename", from: json)
payloadRef = xcOptional(element: "payloadRef", from: json)
Expand Down
16 changes: 16 additions & 0 deletions Sources/XCResultKit/Schema/ActionTestConfiguration.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// File.swift
//
//
// Created by David House on 9/17/22.
//

import Foundation

public struct ActionTestConfiguration: XCResultObject {
public let userInfo: SortedKeyValueArray?

public init?(_ json: [String: AnyObject]) {
userInfo = xcOptional(element: "userInfo", from: json)
}
}
36 changes: 36 additions & 0 deletions Sources/XCResultKit/Schema/ActionTestExpectedFailure.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// File.swift
//
//
// Created by David House on 9/17/22.
//

import Foundation

//- ActionTestExpectedFailure
// * Kind: object
// * Properties:
// + uuid: String
// + failureReason: String?
// + failureSummary: ActionTestFailureSummary?
// + isTopLevelFailure: Bool

public struct ActionTestExpectedFailure: XCResultObject {

public let uuid: String?
public let failureReason: String?
public let failureSummary: ActionTestFailureSummary?
public let isTopLevelFailure: Bool

public init?(_ json: [String: AnyObject]) {
do {
uuid = xcOptional(element: "uuid", from: json)
failureReason = xcOptional(element: "failureReason", from: json)
failureSummary = xcOptional(element: "failureSummary", from: json)
isTopLevelFailure = try xcRequired(element: "isTopLevelFailure", from: json)
} catch {
logError("Error parsing ActionTestExpectedFailure: \(error.localizedDescription)")
return nil
}
}
}
58 changes: 58 additions & 0 deletions Sources/XCResultKit/Schema/ActionTestFailureSummary.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//
// File.swift
//
//
// Created by David House on 7/3/19.
//
//- ActionTestFailureSummary
// * Kind: object
// * Properties:
// + message: String?
// + fileName: String
// + lineNumber: Int
// + isPerformanceFailure: Bool
// + uuid: String
// + issueType: String?
// + detailedDescription: String?
// + attachments: [ActionTestAttachment]
// + associatedError: TestAssociatedError?
// + sourceCodeContext: SourceCodeContext?
// + timestamp: Date?
// + isTopLevelFailure: Bool

import Foundation

public struct ActionTestFailureSummary: XCResultObject {
public let message: String?
public let fileName: String?
public let lineNumber: Int
public let isPerformanceFailure: Bool
public let uuid: String
public let issueType: String?
public let detailedDescription: String?
public let attachments: [ActionTestAttachment]
public let associatedError: TestAssociatedError?
public let sourceCodeContext: SourceCodeContext?
public let timestamp: Date?
public let isTopLevelFailure: Bool

public init?(_ json: [String: AnyObject]) {
do {
message = xcOptional(element: "message", from: json)
fileName = xcOptional(element: "fileName", from: json)
lineNumber = xcOptional(element: "lineNumber", from: json) ?? 0
isPerformanceFailure = xcOptional(element: "isPerformanceFailure", from: json) ?? false
uuid = try xcRequired(element: "uuid", from: json)
issueType = xcOptional(element: "issueType", from: json)
detailedDescription = xcOptional(element: "detailedDescription", from: json)
attachments = xcArray(element: "attachments", from: json).ofType(ActionTestAttachment.self)
associatedError = xcOptional(element: "associatedError", from: json)
sourceCodeContext = xcOptional(element: "sourceCodeContext", from: json)
timestamp = xcOptional(element: "timestamp", from: json)
isTopLevelFailure = try xcRequired(element: "isTopLevelFailure", from: json)
} catch {
logError("Error parsing ActionTestExpectedFailure: \(error.localizedDescription)")
return nil
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@

import Foundation

public struct ActionTestMetadata: XCResultObject {
public let name: String
public let identifier: String
public struct ActionTestMetadata: XCResultObject {

public let identifier: String?
public let identifierURL: String?

public let name: String?

public let testStatus: String
public let duration: Double?
public let summaryRef: Reference?
Expand All @@ -29,8 +33,9 @@ public struct ActionTestMetadata: XCResultObject {

public init?(_ json: [String: AnyObject]) {
do {
name = try xcRequired(element: "name", from: json)
identifier = try xcRequired(element: "identifier", from: json)
identifier = xcOptional(element: "identifier", from: json)
identifierURL = xcOptional(element: "identifierURL", from: json)
name = xcOptional(element: "name", from: json)
testStatus = try xcRequired(element: "testStatus", from: json)
duration = xcOptional(element: "duration", from: json)
summaryRef = xcOptional(element: "summaryRef", from: json)
Expand Down
35 changes: 35 additions & 0 deletions Sources/XCResultKit/Schema/ActionTestNoticeSummary.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// File.swift
//
//
// Created by David House on 9/17/22.
//

import Foundation

//- ActionTestNoticeSummary
// * Kind: object
// * Properties:
// + message: String?
// + fileName: String
// + lineNumber: Int
// + timestamp: Date?

public struct ActionTestNoticeSummary: XCResultObject {
public let message: String?
public let fileName: String
public let lineNumber: Int
public let timestamp: Date?

public init?(_ json: [String: AnyObject]) {
do {
message = xcOptional(element: "message", from: json)
fileName = try xcRequired(element: "fileName", from: json)
lineNumber = try xcRequired(element: "lineNumber", from: json)
timestamp = xcOptional(element: "timestamp", from: json)
} catch {
logError("Error parsing ActionTestNoticeSummary: \(error.localizedDescription)")
return nil
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public struct ActionTestPerformanceMetricSummary: XCResultObject {
public let maxPercentRelativeStandardDeviation: Double?
public let maxRegression: Double?
public let maxStandardDeviation: Double?
public let polarity: String?

public init?(_ json: [String: AnyObject]) {
do {
Expand All @@ -44,6 +45,7 @@ public struct ActionTestPerformanceMetricSummary: XCResultObject {
maxPercentRelativeStandardDeviation = xcOptional(element: "maxPercentRelativeStandardDeviation", from: json)
maxRegression = xcOptional(element: "maxRegression", from: json)
maxStandardDeviation = xcOptional(element: "maxStandardDeviation", from: json)
polarity = xcOptional(element: "polarity", from: json)
} catch {
logError("Error parsing ActionTestPerformanceMetricSummary: \(error.localizedDescription)")
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@
import Foundation

public struct ActionTestPlanRunSummary: XCResultObject {
public var name: String

public let name: String?

public let testableSummaries: [ActionTestableSummary]

public init?(_ json: [String: AnyObject]) {
do {
name = try xcRequired(element: "name", from: json)
testableSummaries = xcArray(element: "testableSummaries", from: json).ofType(ActionTestableSummary.self)
} catch {
logError("Error parsing ActionTestPlanRunSummary: \(error.localizedDescription)")
return nil
}
name = xcOptional(element: "name", from: json)

testableSummaries = xcArray(element: "testableSummaries", from: json).ofType(ActionTestableSummary.self)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,38 @@
import Foundation

public struct ActionTestSummary: XCResultObject {

public let name: String
public let identifier: String
public let identifier: String?
public let identifierURL: String?
public let name: String?

public let testStatus: String
public let duration: Double
public let performanceMetrics: [ActionTestPerformanceMetricSummary]
public let failureSummaries: [ActionTestFailureSummary]
public let expectedFailures: [ActionTestExpectedFailure]
public let skipNoticeSummary: ActionTestNoticeSummary?
public let activitySummaries: [ActionTestActivitySummary]
public let repetitionPolicySummary: ActionTestRepetitionPolicySummary?

public let configuration: ActionTestConfiguration?

public init?(_ json: [String: AnyObject]) {
do {
name = try xcRequired(element: "name", from: json)
identifier = try xcRequired(element: "identifier", from: json)
identifier = xcOptional(element: "identifier", from: json)
identifierURL = xcOptional(element: "identifierURL", from: json)
name = xcOptional(element: "name", from: json)

testStatus = try xcRequired(element: "testStatus", from: json)
duration = xcOptional(element: "duration", from: json) ?? 0
performanceMetrics = xcArray(element: "performanceMetrics", from: json)
.ofType(ActionTestPerformanceMetricSummary.self)
failureSummaries = xcArray(element: "failureSummaries", from: json)
.ofType(ActionTestFailureSummary.self)
expectedFailures = xcArray(element: "expectedFailures", from: json).ofType(ActionTestExpectedFailure.self)
skipNoticeSummary = xcOptional(element: "skipNoticeSummary", from: json)
activitySummaries = xcArray(element: "activitySummaries", from: json)
.ofType(ActionTestActivitySummary.self)
repetitionPolicySummary = xcOptional(element: "repetitionPolicySummary", from: json)
configuration = xcOptional(element: "configuration", from: json)
} catch {
logError("Error parsing ActionTestSummary: \(error.localizedDescription)")
return nil
Expand Down
Loading

0 comments on commit 21ba268

Please sign in to comment.