From ad981edad0ac68e628a1334c09957355ff899bf0 Mon Sep 17 00:00:00 2001 From: Rishab Sukumar Date: Fri, 12 Aug 2022 00:18:51 +0400 Subject: [PATCH 1/2] [IMA-12625] Updates for xcresult v3.39 --- FormatDescriptions/xcresult-3.39.txt | 437 ++++++++++++++++++ Sources/XCParseCore/ActionRecord.swift | 5 + Sources/XCParseCore/ActionResult.swift | 5 + .../XCParseCore/ActionTestNoticeSummary.swift | 5 + .../ActionTestSummaryIdentifiableObject.swift | 5 + .../XCParseCore/ActionTestableSummary.swift | 5 + Sources/XCParseCore/ConsoleLogItem.swift | 32 ++ Sources/XCParseCore/ConsoleLogSection.swift | 25 + Sources/XCParseCore/XCPResultDecoding.swift | 6 + 9 files changed, 525 insertions(+) create mode 100644 FormatDescriptions/xcresult-3.39.txt create mode 100644 Sources/XCParseCore/ConsoleLogItem.swift create mode 100644 Sources/XCParseCore/ConsoleLogSection.swift diff --git a/FormatDescriptions/xcresult-3.39.txt b/FormatDescriptions/xcresult-3.39.txt new file mode 100644 index 0000000..7ecf649 --- /dev/null +++ b/FormatDescriptions/xcresult-3.39.txt @@ -0,0 +1,437 @@ +Name: Xcode Result Types +Version: 3.39 +Signature: PS0lrtUj8Aw= +Types: + - ActionAbstractTestSummary + * Kind: object + * Properties: + + name: String? + - ActionDeviceRecord + * Kind: object + * Properties: + + name: String + + isConcreteDevice: Bool + + operatingSystemVersion: String + + operatingSystemVersionWithBuildNumber: String + + nativeArchitecture: String + + modelName: String + + modelCode: String + + modelUTI: String + + identifier: String + + isWireless: Bool + + cpuKind: String + + cpuCount: Int? + + cpuSpeedInMHz: Int? + + busSpeedInMHz: Int? + + ramSizeInMegabytes: Int? + + physicalCPUCoresPerPackage: Int? + + logicalCPUCoresPerPackage: Int? + + platformRecord: ActionPlatformRecord + - ActionPlatformRecord + * Kind: object + * Properties: + + identifier: String + + userDescription: String + - ActionRecord + * Kind: object + * Properties: + + schemeCommandName: String + + schemeTaskName: String + + title: String? + + startedTime: Date + + endedTime: Date + + runDestination: ActionRunDestinationRecord + + buildResult: ActionResult + + actionResult: ActionResult + + testPlanName: String? + - ActionResult + * Kind: object + * Properties: + + resultName: String + + status: String + + metrics: ResultMetrics + + issues: ResultIssueSummaries + + coverage: CodeCoverageInfo + + timelineRef: Reference? + + logRef: Reference? + + testsRef: Reference? + + diagnosticsRef: Reference? + + consoleLogRef: Reference? + - ActionRunDestinationRecord + * Kind: object + * Properties: + + displayName: String + + targetArchitecture: String + + targetDeviceRecord: ActionDeviceRecord + + localComputerRecord: ActionDeviceRecord + + targetSDKRecord: ActionSDKRecord + - ActionSDKRecord + * Kind: object + * Properties: + + name: String + + identifier: String + + operatingSystemVersion: String + + isInternal: Bool + - ActionTestActivitySummary + * Kind: object + * Properties: + + title: String + + activityType: String + + uuid: String + + start: Date? + + finish: Date? + + attachments: [ActionTestAttachment] + + subactivities: [ActionTestActivitySummary] + + failureSummaryIDs: [String] + + expectedFailureIDs: [String] + - ActionTestAttachment + * Kind: object + * Properties: + + uniformTypeIdentifier: String + + name: String? + + uuid: String? + + timestamp: Date? + + userInfo: SortedKeyValueArray? + + lifetime: String + + inActivityIdentifier: Int + + filename: String? + + payloadRef: Reference? + + payloadSize: Int + - ActionTestConfiguration + * Kind: object + * Properties: + + values: SortedKeyValueArray + - ActionTestExpectedFailure + * Kind: object + * Properties: + + uuid: String + + failureReason: String? + + failureSummary: ActionTestFailureSummary? + + isTopLevelFailure: Bool + - 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 + - ActionTestMetadata + * Supertype: ActionTestSummaryIdentifiableObject + * Kind: object + * Properties: + + testStatus: String + + duration: Double? + + summaryRef: Reference? + + performanceMetricsCount: Int + + failureSummariesCount: Int + + activitySummariesCount: Int + - ActionTestNoticeSummary + * Kind: object + * Properties: + + message: String? + + fileName: String + + lineNumber: Int + + timestamp: Date? + - ActionTestPerformanceMetricSummary + * Kind: object + * Properties: + + displayName: String + + unitOfMeasurement: String + + measurements: [Double] + + identifier: String? + + baselineName: String? + + baselineAverage: Double? + + maxPercentRegression: Double? + + maxPercentRelativeStandardDeviation: Double? + + maxRegression: Double? + + maxStandardDeviation: Double? + + polarity: String? + - ActionTestPlanRunSummaries + * Kind: object + * Properties: + + summaries: [ActionTestPlanRunSummary] + - ActionTestPlanRunSummary + * Supertype: ActionAbstractTestSummary + * Kind: object + * Properties: + + testableSummaries: [ActionTestableSummary] + - ActionTestRepetitionPolicySummary + * Kind: object + * Properties: + + iteration: Int? + + totalIterations: Int? + + repetitionMode: String? + - ActionTestSummary + * Supertype: ActionTestSummaryIdentifiableObject + * Kind: object + * Properties: + + testStatus: String + + duration: Double + + performanceMetrics: [ActionTestPerformanceMetricSummary] + + failureSummaries: [ActionTestFailureSummary] + + expectedFailures: [ActionTestExpectedFailure] + + skipNoticeSummary: ActionTestNoticeSummary? + + activitySummaries: [ActionTestActivitySummary] + + repetitionPolicySummary: ActionTestRepetitionPolicySummary? + + configuration: ActionTestConfiguration? + - ActionTestSummaryGroup + * Supertype: ActionTestSummaryIdentifiableObject + * Kind: object + * Properties: + + duration: Double + + subtests: [ActionTestSummaryIdentifiableObject] + - ActionTestSummaryIdentifiableObject + * Supertype: ActionAbstractTestSummary + * Kind: object + * Properties: + + identifier: String? + + identifierURL: String? + - ActionTestableSummary + * Supertype: ActionAbstractTestSummary + * Kind: object + * Properties: + + identifierURL: String? + + projectRelativePath: String? + + targetName: String? + + testKind: String? + + tests: [ActionTestSummaryIdentifiableObject] + + diagnosticsDirectoryName: String? + + failureSummaries: [ActionTestFailureSummary] + + testLanguage: String? + + testRegion: String? + - ActionsInvocationMetadata + * Kind: object + * Properties: + + creatingWorkspaceFilePath: String + + uniqueIdentifier: String + + schemeIdentifier: EntityIdentifier? + - ActionsInvocationRecord + * Kind: object + * Properties: + + metadataRef: Reference? + + metrics: ResultMetrics + + issues: ResultIssueSummaries + + actions: [ActionRecord] + + archive: ArchiveInfo? + - ActivityLogAnalyzerControlFlowStep + * Supertype: ActivityLogAnalyzerStep + * Kind: object + * Properties: + + title: String + + startLocation: DocumentLocation? + + endLocation: DocumentLocation? + + edges: [ActivityLogAnalyzerControlFlowStepEdge] + - ActivityLogAnalyzerControlFlowStepEdge + * Kind: object + * Properties: + + startLocation: DocumentLocation? + + endLocation: DocumentLocation? + - ActivityLogAnalyzerEventStep + * Supertype: ActivityLogAnalyzerStep + * Kind: object + * Properties: + + title: String + + location: DocumentLocation? + + description: String + + callDepth: Int + - ActivityLogAnalyzerResultMessage + * Supertype: ActivityLogMessage + * Kind: object + * Properties: + + steps: [ActivityLogAnalyzerStep] + + resultType: String? + + keyEventIndex: Int + - ActivityLogAnalyzerStep + * Kind: object + * Properties: + + parentIndex: Int + - ActivityLogAnalyzerWarningMessage + * Supertype: ActivityLogMessage + * Kind: object + - ActivityLogCommandInvocationSection + * Supertype: ActivityLogSection + * Kind: object + * Properties: + + commandDetails: String + + emittedOutput: String + + exitCode: Int? + - ActivityLogMajorSection + * Supertype: ActivityLogSection + * Kind: object + * Properties: + + subtitle: String + - ActivityLogMessage + * Kind: object + * Properties: + + type: String + + title: String + + shortTitle: String? + + category: String? + + location: DocumentLocation? + + annotations: [ActivityLogMessageAnnotation] + - ActivityLogMessageAnnotation + * Kind: object + * Properties: + + title: String + + location: DocumentLocation? + - ActivityLogSection + * Kind: object + * Properties: + + domainType: String + + title: String + + startTime: Date? + + duration: Double + + result: String? + + location: DocumentLocation? + + subsections: [ActivityLogSection] + + messages: [ActivityLogMessage] + - ActivityLogTargetBuildSection + * Supertype: ActivityLogMajorSection + * Kind: object + * Properties: + + productType: String? + - ActivityLogUnitTestSection + * Supertype: ActivityLogSection + * Kind: object + * Properties: + + testName: String? + + suiteName: String? + + summary: String? + + emittedOutput: String? + + performanceTestOutput: String? + + testsPassedString: String? + + wasSkipped: Bool + + runnablePath: String? + + runnableUTI: String? + - ArchiveInfo + * Kind: object + * Properties: + + path: String? + - Array + * Kind: array + - Bool + * Kind: value + - CodeCoverageInfo + * Kind: object + * Properties: + + hasCoverageData: Bool + + reportRef: Reference? + + archiveRef: Reference? + - ConsoleLogItem + * Kind: object + * Properties: + + adaptorType: String? + + kind: String? + + timestamp: Double + + content: String + - ConsoleLogSection + * Kind: object + * Properties: + + title: String + + items: [ConsoleLogItem] + - Date + * Kind: value + - DocumentLocation + * Kind: object + * Properties: + + url: String + + concreteTypeName: String + - Double + * Kind: value + - EntityIdentifier + * Kind: object + * Properties: + + entityName: String + + containerName: String + + entityType: String + + sharedState: String + - Int + * Kind: value + - IssueSummary + * Kind: object + * Properties: + + issueType: String + + message: String + + producingTarget: String? + + documentLocationInCreatingWorkspace: DocumentLocation? + - ObjectID + * Kind: object + * Properties: + + hash: String + - Reference + * Kind: object + * Properties: + + id: String + + targetType: TypeDefinition? + - ResultIssueSummaries + * Kind: object + * Properties: + + analyzerWarningSummaries: [IssueSummary] + + errorSummaries: [IssueSummary] + + testFailureSummaries: [TestFailureIssueSummary] + + warningSummaries: [IssueSummary] + - ResultMetrics + * Kind: object + * Properties: + + analyzerWarningCount: Int + + errorCount: Int + + testsCount: Int + + testsFailedCount: Int + + testsSkippedCount: Int + + warningCount: Int + - SortedKeyValueArray + * Kind: object + * Properties: + + storage: [SortedKeyValueArrayPair] + - SortedKeyValueArrayPair + * Kind: object + * Properties: + + key: String + + value: SchemaSerializable + - SourceCodeContext + * Kind: object + * Properties: + + location: SourceCodeLocation? + + callStack: [SourceCodeFrame] + - SourceCodeFrame + * Kind: object + * Properties: + + addressString: String? + + symbolInfo: SourceCodeSymbolInfo? + - SourceCodeLocation + * Kind: object + * Properties: + + filePath: String? + + lineNumber: Int? + - SourceCodeSymbolInfo + * Kind: object + * Properties: + + imageName: String? + + symbolName: String? + + location: SourceCodeLocation? + - String + * Kind: value + - TestAssociatedError + * Kind: object + * Properties: + + domain: String? + + code: Int? + + userInfo: SortedKeyValueArray? + - TestFailureIssueSummary + * Supertype: IssueSummary + * Kind: object + * Properties: + + testCaseName: String + - TypeDefinition + * Kind: object + * Properties: + + name: String + + supertype: TypeDefinition? diff --git a/Sources/XCParseCore/ActionRecord.swift b/Sources/XCParseCore/ActionRecord.swift index ad31872..31431d5 100644 --- a/Sources/XCParseCore/ActionRecord.swift +++ b/Sources/XCParseCore/ActionRecord.swift @@ -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 @@ -27,6 +30,7 @@ open class ActionRecord : Codable { case runDestination case buildResult case actionResult + case testPlanName } required public init(from decoder: Decoder) throws { @@ -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) } } diff --git a/Sources/XCParseCore/ActionResult.swift b/Sources/XCParseCore/ActionResult.swift index cbb2e51..91f9f38 100644 --- a/Sources/XCParseCore/ActionResult.swift +++ b/Sources/XCParseCore/ActionResult.swift @@ -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 @@ -29,6 +32,7 @@ open class ActionResult : Codable { case logRef case testsRef case diagnosticsRef + case consoleLogRef } required public init(from decoder: Decoder) throws { @@ -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) } } diff --git a/Sources/XCParseCore/ActionTestNoticeSummary.swift b/Sources/XCParseCore/ActionTestNoticeSummary.swift index e9704ee..069eefc 100644 --- a/Sources/XCParseCore/ActionTestNoticeSummary.swift +++ b/Sources/XCParseCore/ActionTestNoticeSummary.swift @@ -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 { @@ -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) } } diff --git a/Sources/XCParseCore/ActionTestSummaryIdentifiableObject.swift b/Sources/XCParseCore/ActionTestSummaryIdentifiableObject.swift index fb34685..e19e468 100644 --- a/Sources/XCParseCore/ActionTestSummaryIdentifiableObject.swift +++ b/Sources/XCParseCore/ActionTestSummaryIdentifiableObject.swift @@ -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) } } diff --git a/Sources/XCParseCore/ActionTestableSummary.swift b/Sources/XCParseCore/ActionTestableSummary.swift index c0c3f51..bba63f4 100644 --- a/Sources/XCParseCore/ActionTestableSummary.swift +++ b/Sources/XCParseCore/ActionTestableSummary.swift @@ -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 @@ -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) diff --git a/Sources/XCParseCore/ConsoleLogItem.swift b/Sources/XCParseCore/ConsoleLogItem.swift new file mode 100644 index 0000000..90e2a16 --- /dev/null +++ b/Sources/XCParseCore/ConsoleLogItem.swift @@ -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) + } +} + diff --git a/Sources/XCParseCore/ConsoleLogSection.swift b/Sources/XCParseCore/ConsoleLogSection.swift new file mode 100644 index 0000000..28a2c9c --- /dev/null +++ b/Sources/XCParseCore/ConsoleLogSection.swift @@ -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) + } +} diff --git a/Sources/XCParseCore/XCPResultDecoding.swift b/Sources/XCParseCore/XCPResultDecoding.swift index efb2f90..9480f40 100644 --- a/Sources/XCParseCore/XCPResultDecoding.swift +++ b/Sources/XCParseCore/XCPResultDecoding.swift @@ -150,6 +150,8 @@ enum XCResultTypeFamily: String, ClassFamily { case Array case Bool case CodeCoverageInfo + case ConsoleLogItem + case ConsoleLogSection case Date case DocumentLocation case Double @@ -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: From 86da27e955ff1587aae13cd4de218ec136bdb8b1 Mon Sep 17 00:00:00 2001 From: Alexander Botkin Date: Thu, 11 Aug 2022 15:01:06 -0700 Subject: [PATCH 2/2] Switch over to using an ephemeral URL session for the version check We're noticing that our CI/CD is getting the error "volume does not support data protection, stripping SQLITE_OPEN_FILEPROTECTION_* flags". Reports from others online point to the URL session attempting to write data that causes this in that particular environment where data protection is unavailable. As we don't need anything to be stored to disk for this, changing to ephemeral will prevent URL session from attempting the write and causing that log warning to be emitted. --- Sources/xcparse/XCPParser.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/xcparse/XCPParser.swift b/Sources/xcparse/XCPParser.swift index 1f276dc..9981566 100644 --- a/Sources/xcparse/XCPParser.swift +++ b/Sources/xcparse/XCPParser.swift @@ -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 }