Skip to content

Commit

Permalink
Merge pull request #75 from ChargePoint/IMA-12625
Browse files Browse the repository at this point in the history
[IMA-12625] Updates for xcresult v3.39
  • Loading branch information
rsukumar-cpi authored Aug 11, 2022
2 parents caa37a5 + 86da27e commit bf23d8e
Show file tree
Hide file tree
Showing 10 changed files with 527 additions and 1 deletion.
437 changes: 437 additions & 0 deletions FormatDescriptions/xcresult-3.39.txt

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions Sources/XCParseCore/ActionRecord.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ open class ActionRecord : Codable {
public let runDestination: ActionRunDestinationRecord
public let buildResult: ActionResult
public let actionResult: ActionResult

// xcresult 3.39 and above
public let testPlanName: String?

enum ActionRecordCodingKeys: String, CodingKey {
case schemeCommandName
Expand All @@ -27,6 +30,7 @@ open class ActionRecord : Codable {
case runDestination
case buildResult
case actionResult
case testPlanName
}

required public init(from decoder: Decoder) throws {
Expand All @@ -39,5 +43,6 @@ open class ActionRecord : Codable {
runDestination = try container.decodeXCResultObject(forKey: .runDestination)
buildResult = try container.decodeXCResultObject(forKey: .buildResult)
actionResult = try container.decodeXCResultObject(forKey: .actionResult)
testPlanName = try container.decodeXCResultTypeIfPresent(forKey: .testPlanName)
}
}
5 changes: 5 additions & 0 deletions Sources/XCParseCore/ActionResult.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ open class ActionResult : Codable {
public let logRef: Reference?
public let testsRef: Reference?
public let diagnosticsRef: Reference?

// xcresult 3.39 and above
public let consoleLogRef: Reference?

enum ActionResultCodingKeys: String, CodingKey {
case resultName
Expand All @@ -29,6 +32,7 @@ open class ActionResult : Codable {
case logRef
case testsRef
case diagnosticsRef
case consoleLogRef
}

required public init(from decoder: Decoder) throws {
Expand All @@ -42,5 +46,6 @@ open class ActionResult : Codable {
logRef = try container.decodeXCResultObjectIfPresent(forKey: .logRef)
testsRef = try container.decodeXCResultObjectIfPresent(forKey: .testsRef)
diagnosticsRef = try container.decodeXCResultObjectIfPresent(forKey: .diagnosticsRef)
consoleLogRef = try container.decodeXCResultObjectIfPresent(forKey: .consoleLogRef)
}
}
5 changes: 5 additions & 0 deletions Sources/XCParseCore/ActionTestNoticeSummary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ open class ActionTestNoticeSummary : Codable {
public let message: String?
public let fileName: String
public let lineNumber: Int

// xcresult 3.39 and above
public let timestamp: Date?

enum ActionTestNoticeSummaryCodingKeys: String, CodingKey {
case message
case fileName
case lineNumber
case timestamp
}

required public init(from decoder: Decoder) throws {
Expand All @@ -25,5 +29,6 @@ open class ActionTestNoticeSummary : Codable {
message = try container.decodeXCResultTypeIfPresent(forKey: .message)
fileName = try container.decodeXCResultType(forKey: .fileName)
lineNumber = try container.decodeXCResultType(forKey: .lineNumber)
timestamp = try container.decodeXCResultTypeIfPresent(forKey: .timestamp)
}
}
5 changes: 5 additions & 0 deletions Sources/XCParseCore/ActionTestSummaryIdentifiableObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ import Foundation

open class ActionTestSummaryIdentifiableObject : ActionAbstractTestSummary {
public let identifier: String?

// xcresult 3.39 and above
public let identifierURL: String?

enum ActionTestSummaryIdentifiableObjectCodingKeys: String, CodingKey {
case identifier
case identifierURL
}

required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: ActionTestSummaryIdentifiableObjectCodingKeys.self)
identifier = try container.decodeXCResultTypeIfPresent(forKey: .identifier)
identifierURL = try container.decodeXCResultTypeIfPresent(forKey: .identifierURL)
try super.init(from: decoder)
}
}
5 changes: 5 additions & 0 deletions Sources/XCParseCore/ActionTestableSummary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ open class ActionTestableSummary : ActionAbstractTestSummary {
public let failureSummaries: [ActionTestFailureSummary]
public let testLanguage: String?
public let testRegion: String?

// xcresult 3.39 and above
public let identifierURL: String?

enum ActionTestableSummaryCodingKeys: String, CodingKey {
case identifierURL
case projectRelativePath
case targetName
case testKind
Expand All @@ -31,6 +35,7 @@ open class ActionTestableSummary : ActionAbstractTestSummary {

required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: ActionTestableSummaryCodingKeys.self)
identifierURL = try container.decodeXCResultTypeIfPresent(forKey: .identifierURL)
projectRelativePath = try container.decodeXCResultTypeIfPresent(forKey: .projectRelativePath)
targetName = try container.decodeXCResultTypeIfPresent(forKey: .targetName)
testKind = try container.decodeXCResultTypeIfPresent(forKey: .testKind)
Expand Down
32 changes: 32 additions & 0 deletions Sources/XCParseCore/ConsoleLogItem.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// ConsoleLogItem.swift
// XCParseCore
//
// Created by Rishab Sukumar on 8/11/22.
// Copyright © 2022 ChargePoint, Inc. All rights reserved.

import Foundation

// xcresult 3.39 and above
open class ConsoleLogItem : Codable {
public let adaptorType: String?
public let kind: String?
public let timestamp: Double
public let content: String

enum ConsoleLogItemCodingKeys: String, CodingKey {
case adaptorType
case kind
case timestamp
case content
}

required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: ConsoleLogItemCodingKeys.self)
adaptorType = try container.decodeXCResultTypeIfPresent(forKey: .adaptorType)
kind = try container.decodeXCResultTypeIfPresent(forKey: .kind)
timestamp = try container.decodeXCResultType(forKey: .timestamp)
content = try container.decodeXCResultType(forKey: .content)
}
}

25 changes: 25 additions & 0 deletions Sources/XCParseCore/ConsoleLogSection.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// ConsoleLogSection.swift
// XCParseCore
//
// Created by Rishab Sukumar on 8/11/22.
// Copyright © 2022 ChargePoint, Inc. All rights reserved.

import Foundation

// xcresult 3.39 and above
open class ConsoleLogSection : Codable {
public let title: String
public let items: [ConsoleLogItem]

enum ConsoleLogSectionCodingKeys: String, CodingKey {
case title
case items
}

required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: ConsoleLogSectionCodingKeys.self)
title = try container.decodeXCResultType(forKey: .title)
items = try container.decodeXCResultArray(forKey: .items)
}
}
6 changes: 6 additions & 0 deletions Sources/XCParseCore/XCPResultDecoding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ enum XCResultTypeFamily: String, ClassFamily {
case Array
case Bool
case CodeCoverageInfo
case ConsoleLogItem
case ConsoleLogSection
case Date
case DocumentLocation
case Double
Expand Down Expand Up @@ -257,6 +259,10 @@ enum XCResultTypeFamily: String, ClassFamily {
return XCParseCore.XCResultValueType.self
case .CodeCoverageInfo:
return XCParseCore.CodeCoverageInfo.self
case .ConsoleLogItem:
return XCParseCore.ConsoleLogItem.self
case .ConsoleLogSection:
return XCParseCore.ConsoleLogSection.self
case .Date:
return XCParseCore.XCResultValueType.self
case .DocumentLocation:
Expand Down
3 changes: 2 additions & 1 deletion Sources/xcparse/XCPParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@ class XCPParser {
var releaseRequest = URLRequest(url: latestReleaseURL)
releaseRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")

let task = URLSession.shared.dataTask(with: releaseRequest) { (data, response, error) in
let urlSession = URLSession(configuration: .ephemeral)
let task = urlSession.dataTask(with: releaseRequest) { (data, response, error) in
if error != nil || data == nil {
return
}
Expand Down

0 comments on commit bf23d8e

Please sign in to comment.