From 70fea6d250d25faa0d3ec5a694f44f10047a39e5 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Mon, 13 Dec 2021 16:04:04 -0800 Subject: [PATCH] [tool] XCResult also parses "url" in xcresult bundle (#95054) --- .../flutter_tools/lib/src/ios/xcresult.dart | 67 +- .../test/general.shard/ios/xcresult_test.dart | 1060 +---------- .../general.shard/ios/xcresult_test_data.dart | 1573 +++++++++++++++++ 3 files changed, 1664 insertions(+), 1036 deletions(-) create mode 100644 packages/flutter_tools/test/general.shard/ios/xcresult_test_data.dart diff --git a/packages/flutter_tools/lib/src/ios/xcresult.dart b/packages/flutter_tools/lib/src/ios/xcresult.dart index 25418b247e..2ef20c19a8 100644 --- a/packages/flutter_tools/lib/src/ios/xcresult.dart +++ b/packages/flutter_tools/lib/src/ios/xcresult.dart @@ -178,8 +178,9 @@ class XCResultIssue { required XCResultIssueType type, required Map issueJson, }) { + // Parse type. final Object? issueSubTypeMap = issueJson['issueType']; - String subType = ''; + String? subType; if (issueSubTypeMap is Map) { final Object? subTypeValue = issueSubTypeMap['_value']; if (subTypeValue is String) { @@ -187,7 +188,8 @@ class XCResultIssue { } } - String message = ''; + // Parse message. + String? message; final Object? messageMap = issueJson['message']; if (messageMap is Map) { final Object? messageValue = messageMap['_value']; @@ -196,10 +198,30 @@ class XCResultIssue { } } + final List warnings = []; + // Parse url and convert it to a location String. + String? location; + final Object? documentLocationInCreatingWorkspaceMap = + issueJson['documentLocationInCreatingWorkspace']; + if (documentLocationInCreatingWorkspaceMap is Map) { + final Object? urlMap = documentLocationInCreatingWorkspaceMap['url']; + if (urlMap is Map) { + final Object? urlValue = urlMap['_value']; + if (urlValue is String) { + location = _convertUrlToLocationString(urlValue); + if (location == null) { + warnings.add('(XCResult) The `url` exists but it was failed to be parsed. url: $urlValue'); + } + } + } + } + return XCResultIssue._( type: type, subType: subType, message: message, + location: location, + warnings: warnings, ); } @@ -207,6 +229,8 @@ class XCResultIssue { required this.type, required this.subType, required this.message, + required this.location, + required this.warnings, }); /// The type of the issue. @@ -216,12 +240,21 @@ class XCResultIssue { /// /// This is a more detailed category about the issue. /// The possible values are `Warning`, `Semantic Issue'` etc. - final String subType; + final String? subType; /// Human readable message for the issue. /// /// This can be displayed to user for their information. - final String message; + final String? message; + + /// The location where the issue occurs. + /// + /// This is a re-formatted version of the "url" value in the json. + /// The format looks like ::. + final String? location; + + /// Warnings when constructing the issue object. + final List warnings; } /// The type of an `XCResultIssue`. @@ -236,3 +269,29 @@ enum XCResultIssueType { /// This is for all the issues under the `errorSummaries` key in the xcresult. error, } + +// A typical location url string looks like file:///foo.swift#CharacterRangeLen=0&EndingColumnNumber=82&EndingLineNumber=7&StartingColumnNumber=82&StartingLineNumber=7. +// +// This function converts it to something like: /foo.swift::. +String? _convertUrlToLocationString(String url) { + final Uri? fragmentLocation = Uri.tryParse(url); + if (fragmentLocation == null) { + return null; + } + // Parse the fragment as a query of key-values: + final Uri fileLocation = Uri( + path: fragmentLocation.path, + query: fragmentLocation.fragment, + ); + String startingLineNumber = + fileLocation.queryParameters['StartingLineNumber'] ?? ''; + if (startingLineNumber.isNotEmpty) { + startingLineNumber = ':$startingLineNumber'; + } + String startingColumnNumber = + fileLocation.queryParameters['StartingColumnNumber'] ?? ''; + if (startingColumnNumber.isNotEmpty) { + startingColumnNumber = ':$startingColumnNumber'; + } + return '${fileLocation.path}$startingLineNumber$startingColumnNumber'; +} diff --git a/packages/flutter_tools/test/general.shard/ios/xcresult_test.dart b/packages/flutter_tools/test/general.shard/ios/xcresult_test.dart index b39c929ac9..5dcf9f2947 100644 --- a/packages/flutter_tools/test/general.shard/ios/xcresult_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/xcresult_test.dart @@ -10,6 +10,7 @@ import 'package:flutter_tools/src/macos/xcode.dart'; import '../../src/common.dart'; import '../../src/fake_process_manager.dart'; +import 'xcresult_test_data.dart'; void main() { // Creates a FakeCommand for the xcresult get call to build the app @@ -94,12 +95,13 @@ void main() { testWithoutContext( 'correctly parse sample result json when there are issues.', () async { - final XCResultGenerator generator = _setupGenerator(resultJson: _sampleResultJsonWithIssues); + final XCResultGenerator generator = _setupGenerator(resultJson: kSampleResultJsonWithIssues); final XCResult result = await generator.generate(); expect(result.issues.length, 2); expect(result.issues.first.type, XCResultIssueType.error); expect(result.issues.first.subType, 'Semantic Issue'); expect(result.issues.first.message, "Use of undeclared identifier 'asdas'"); + expect(result.issues.first.location, '/Users/m/Projects/test_create/ios/Runner/AppDelegate.m:7:56'); expect(result.issues.last.type, XCResultIssueType.warning); expect(result.issues.last.subType, 'Warning'); expect(result.issues.last.message, @@ -108,9 +110,28 @@ void main() { expect(result.parsingErrorMessage, isNull); }); + testWithoutContext( + 'correctly parse sample result json when there are issues but invalid url.', () async { + final XCResultGenerator generator = _setupGenerator(resultJson: kSampleResultJsonWithIssuesAndInvalidUrl); + final XCResult result = await generator.generate(); + expect(result.issues.length, 2); + expect(result.issues.first.type, XCResultIssueType.error); + expect(result.issues.first.subType, 'Semantic Issue'); + expect(result.issues.first.message, "Use of undeclared identifier 'asdas'"); + expect(result.issues.first.location, isNull); + expect(result.issues.first.warnings.first, '(XCResult) The `url` exists but it was failed to be parsed. url: 3:00'); + expect(result.issues.last.type, XCResultIssueType.warning); + expect(result.issues.last.subType, 'Warning'); + expect(result.issues.last.message, + "The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99."); + expect(result.parseSuccess, isTrue); + expect(result.parsingErrorMessage, isNull); + }); + + testWithoutContext('correctly parse sample result json when no issues.', () async { - final XCResultGenerator generator = _setupGenerator(resultJson: _sampleResultJsonNoIssues); + final XCResultGenerator generator = _setupGenerator(resultJson: kSampleResultJsonNoIssues); final XCResult result = await generator.generate(); expect(result.issues.length, 0); expect(result.parseSuccess, isTrue); @@ -165,7 +186,7 @@ void main() { testWithoutContext('error: empty actions map', () async { final XCResultGenerator generator = - _setupGenerator(resultJson: _sampleResultJsonEmptyActionsMap); + _setupGenerator(resultJson: kSampleResultJsonEmptyActionsMap); final XCResult result = await generator.generate(); expect(result.issues.length, 0); @@ -175,7 +196,7 @@ void main() { }); testWithoutContext('error: empty actions map', () async { - final XCResultGenerator generator = _setupGenerator(resultJson: _sampleResultJsonEmptyActionsMap); + final XCResultGenerator generator = _setupGenerator(resultJson: kSampleResultJsonEmptyActionsMap); final XCResult result = await generator.generate(); expect(result.issues.length, 0); @@ -185,7 +206,7 @@ void main() { }); testWithoutContext('error: empty actions map', () async { - final XCResultGenerator generator = _setupGenerator(resultJson: _sampleResultJsonInvalidActionMap); + final XCResultGenerator generator = _setupGenerator(resultJson: kSampleResultJsonInvalidActionMap); final XCResult result = await generator.generate(); expect(result.issues.length, 0); @@ -195,7 +216,7 @@ void main() { }); testWithoutContext('error: empty actions map', () async { - final XCResultGenerator generator = _setupGenerator(resultJson: _sampleResultJsonInvalidBuildResultMap); + final XCResultGenerator generator = _setupGenerator(resultJson: kSampleResultJsonInvalidBuildResultMap); final XCResult result = await generator.generate(); expect(result.issues.length, 0); @@ -205,7 +226,7 @@ void main() { }); testWithoutContext('error: empty actions map', () async { - final XCResultGenerator generator = _setupGenerator(resultJson: _sampleResultJsonInvalidIssuesMap); + final XCResultGenerator generator = _setupGenerator(resultJson: kSampleResultJsonInvalidIssuesMap); final XCResult result = await generator.generate(); expect(result.issues.length, 0); @@ -215,1029 +236,4 @@ void main() { }); } -const String _sampleResultJsonInvalidIssuesMap = r''' -{ - "_type" : { - "_name" : "ActionsInvocationRecord" - }, - "actions" : { - "_type" : { - "_name" : "Array" - }, - "_values" : [ - { - "buildResult": { - } - } - ] - } -} -'''; - -const String _sampleResultJsonInvalidBuildResultMap = r''' -{ - "_type" : { - "_name" : "ActionsInvocationRecord" - }, - "actions" : { - "_type" : { - "_name" : "Array" - }, - "_values" : [ - {} - ] - } -} -'''; - -const String _sampleResultJsonInvalidActionMap = r''' -{ - "_type" : { - "_name" : "ActionsInvocationRecord" - }, - "actions" : { - "_type" : { - "_name" : "Array" - }, - "_values" : [ - [] - ] - } -} -'''; - -const String _sampleResultJsonEmptyActionsMap = r''' -{ - "_type" : { - "_name" : "ActionsInvocationRecord" - }, - "actions" : { - "_type" : { - "_name" : "Array" - }, - "_values" : [ - ] - } -} -'''; - -const String _sampleResultJsonWithIssues = r''' -{ - "_type" : { - "_name" : "ActionsInvocationRecord" - }, - "actions" : { - "_type" : { - "_name" : "Array" - }, - "_values" : [ - { - "_type" : { - "_name" : "ActionRecord" - }, - "actionResult" : { - "_type" : { - "_name" : "ActionResult" - }, - "coverage" : { - "_type" : { - "_name" : "CodeCoverageInfo" - } - }, - "issues" : { - "_type" : { - "_name" : "ResultIssueSummaries" - } - }, - "metrics" : { - "_type" : { - "_name" : "ResultMetrics" - } - }, - "resultName" : { - "_type" : { - "_name" : "String" - }, - "_value" : "action" - }, - "status" : { - "_type" : { - "_name" : "String" - }, - "_value" : "notRequested" - } - }, - "buildResult" : { - "_type" : { - "_name" : "ActionResult" - }, - "coverage" : { - "_type" : { - "_name" : "CodeCoverageInfo" - } - }, - "issues" : { - "_type" : { - "_name" : "ResultIssueSummaries" - }, - "errorSummaries" : { - "_type" : { - "_name" : "Array" - }, - "_values" : [ - { - "_type" : { - "_name" : "IssueSummary" - }, - "documentLocationInCreatingWorkspace" : { - "_type" : { - "_name" : "DocumentLocation" - }, - "concreteTypeName" : { - "_type" : { - "_name" : "String" - }, - "_value" : "DVTTextDocumentLocation" - }, - "url" : { - "_type" : { - "_name" : "String" - }, - "_value" : "file:\/\/\/Users\/m\/Projects\/test_create\/ios\/Runner\/AppDelegate.m#CharacterRangeLen=0&CharacterRangeLoc=263&EndingColumnNumber=56&EndingLineNumber=7&LocationEncoding=1&StartingColumnNumber=56&StartingLineNumber=7" - } - }, - "issueType" : { - "_type" : { - "_name" : "String" - }, - "_value" : "Semantic Issue" - }, - "message" : { - "_type" : { - "_name" : "String" - }, - "_value" : "Use of undeclared identifier 'asdas'" - } - } - ] - }, - "warningSummaries" : { - "_type" : { - "_name" : "Array" - }, - "_values" : [ - { - "_type" : { - "_name" : "IssueSummary" - }, - "issueType" : { - "_type" : { - "_name" : "String" - }, - "_value" : "Warning" - }, - "message" : { - "_type" : { - "_name" : "String" - }, - "_value" : "The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99." - } - } - ] - } - }, - "logRef" : { - "_type" : { - "_name" : "Reference" - }, - "id" : { - "_type" : { - "_name" : "String" - }, - "_value" : "0~bjiFq9EH53z6VfWSr47dakT0w_aGcY_GFqgPuexHq1JsoKMmvf_6GLglMcWBYRCSNufKEX6l1YgbFmnuobsw5w==" - }, - "targetType" : { - "_type" : { - "_name" : "TypeDefinition" - }, - "name" : { - "_type" : { - "_name" : "String" - }, - "_value" : "ActivityLogSection" - } - } - }, - "metrics" : { - "_type" : { - "_name" : "ResultMetrics" - }, - "errorCount" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "1" - }, - "warningCount" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "1" - } - }, - "resultName" : { - "_type" : { - "_name" : "String" - }, - "_value" : "build" - }, - "status" : { - "_type" : { - "_name" : "String" - }, - "_value" : "failed" - } - }, - "endedTime" : { - "_type" : { - "_name" : "Date" - }, - "_value" : "2020-09-28T14:31:16.931-0700" - }, - "runDestination" : { - "_type" : { - "_name" : "ActionRunDestinationRecord" - }, - "displayName" : { - "_type" : { - "_name" : "String" - }, - "_value" : "Any iOS Device" - }, - "localComputerRecord" : { - "_type" : { - "_name" : "ActionDeviceRecord" - }, - "busSpeedInMHz" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "100" - }, - "cpuCount" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "1" - }, - "cpuKind" : { - "_type" : { - "_name" : "String" - }, - "_value" : "8-Core Intel Xeon W" - }, - "cpuSpeedInMHz" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "3200" - }, - "identifier" : { - "_type" : { - "_name" : "String" - }, - "_value" : "87BE7059-56E3-5470-B52D-31A0F76402B3" - }, - "isConcreteDevice" : { - "_type" : { - "_name" : "Bool" - }, - "_value" : "true" - }, - "logicalCPUCoresPerPackage" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "16" - }, - "modelCode" : { - "_type" : { - "_name" : "String" - }, - "_value" : "iMacPro1,1" - }, - "modelName" : { - "_type" : { - "_name" : "String" - }, - "_value" : "iMac Pro" - }, - "modelUTI" : { - "_type" : { - "_name" : "String" - }, - "_value" : "com.apple.imacpro-2017" - }, - "name" : { - "_type" : { - "_name" : "String" - }, - "_value" : "My Mac" - }, - "nativeArchitecture" : { - "_type" : { - "_name" : "String" - }, - "_value" : "x86_64h" - }, - "operatingSystemVersion" : { - "_type" : { - "_name" : "String" - }, - "_value" : "10.15.5" - }, - "operatingSystemVersionWithBuildNumber" : { - "_type" : { - "_name" : "String" - }, - "_value" : "10.15.5 (19F101)" - }, - "physicalCPUCoresPerPackage" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "8" - }, - "platformRecord" : { - "_type" : { - "_name" : "ActionPlatformRecord" - }, - "identifier" : { - "_type" : { - "_name" : "String" - }, - "_value" : "com.apple.platform.macosx" - }, - "userDescription" : { - "_type" : { - "_name" : "String" - }, - "_value" : "macOS" - } - }, - "ramSizeInMegabytes" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "65536" - } - }, - "targetArchitecture" : { - "_type" : { - "_name" : "String" - }, - "_value" : "arm64e" - }, - "targetDeviceRecord" : { - "_type" : { - "_name" : "ActionDeviceRecord" - }, - "identifier" : { - "_type" : { - "_name" : "String" - }, - "_value" : "dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder" - }, - "modelCode" : { - "_type" : { - "_name" : "String" - }, - "_value" : "GenericiOS" - }, - "modelName" : { - "_type" : { - "_name" : "String" - }, - "_value" : "GenericiOS" - }, - "modelUTI" : { - "_type" : { - "_name" : "String" - }, - "_value" : "com.apple.dt.Xcode.device.GenericiOS" - }, - "name" : { - "_type" : { - "_name" : "String" - }, - "_value" : "Any iOS Device" - }, - "nativeArchitecture" : { - "_type" : { - "_name" : "String" - }, - "_value" : "arm64e" - }, - "platformRecord" : { - "_type" : { - "_name" : "ActionPlatformRecord" - }, - "identifier" : { - "_type" : { - "_name" : "String" - }, - "_value" : "com.apple.platform.iphoneos" - }, - "userDescription" : { - "_type" : { - "_name" : "String" - }, - "_value" : "iOS" - } - } - }, - "targetSDKRecord" : { - "_type" : { - "_name" : "ActionSDKRecord" - }, - "identifier" : { - "_type" : { - "_name" : "String" - }, - "_value" : "iphoneos14.0" - }, - "name" : { - "_type" : { - "_name" : "String" - }, - "_value" : "iOS 14.0" - }, - "operatingSystemVersion" : { - "_type" : { - "_name" : "String" - }, - "_value" : "14.0" - } - } - }, - "schemeCommandName" : { - "_type" : { - "_name" : "String" - }, - "_value" : "Run" - }, - "schemeTaskName" : { - "_type" : { - "_name" : "String" - }, - "_value" : "Build" - }, - "startedTime" : { - "_type" : { - "_name" : "Date" - }, - "_value" : "2020-09-28T14:31:13.125-0700" - }, - "title" : { - "_type" : { - "_name" : "String" - }, - "_value" : "Build \"Runner\"" - } - } - ] - }, - "issues" : { - "_type" : { - "_name" : "ResultIssueSummaries" - }, - "errorSummaries" : { - "_type" : { - "_name" : "Array" - }, - "_values" : [ - { - "_type" : { - "_name" : "IssueSummary" - }, - "documentLocationInCreatingWorkspace" : { - "_type" : { - "_name" : "DocumentLocation" - }, - "concreteTypeName" : { - "_type" : { - "_name" : "String" - }, - "_value" : "DVTTextDocumentLocation" - }, - "url" : { - "_type" : { - "_name" : "String" - }, - "_value" : "file:\/\/\/Users\/m\/Projects\/test_create\/ios\/Runner\/AppDelegate.m#CharacterRangeLen=0&CharacterRangeLoc=263&EndingColumnNumber=56&EndingLineNumber=7&LocationEncoding=1&StartingColumnNumber=56&StartingLineNumber=7" - } - }, - "issueType" : { - "_type" : { - "_name" : "String" - }, - "_value" : "Semantic Issue" - }, - "message" : { - "_type" : { - "_name" : "String" - }, - "_value" : "Use of undeclared identifier 'asdas'" - } - } - ] - }, - "warningSummaries" : { - "_type" : { - "_name" : "Array" - }, - "_values" : [ - { - "_type" : { - "_name" : "IssueSummary" - }, - "issueType" : { - "_type" : { - "_name" : "String" - }, - "_value" : "Warning" - }, - "message" : { - "_type" : { - "_name" : "String" - }, - "_value" : "The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99." - } - } - ] - } - }, - "metadataRef" : { - "_type" : { - "_name" : "Reference" - }, - "id" : { - "_type" : { - "_name" : "String" - }, - "_value" : "0~hrKQOFMo2Ri-TrlvSpVK8vTHcYQxwuWYJuRHCjoxIleliOdh5fHOdfIALZV0S0FtjVmUB83FpKkPbWajga4wxA==" - }, - "targetType" : { - "_type" : { - "_name" : "TypeDefinition" - }, - "name" : { - "_type" : { - "_name" : "String" - }, - "_value" : "ActionsInvocationMetadata" - } - } - }, - "metrics" : { - "_type" : { - "_name" : "ResultMetrics" - }, - "errorCount" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "1" - }, - "warningCount" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "1" - } - } -} -'''; - -const String _sampleResultJsonNoIssues = r''' -{ - "_type" : { - "_name" : "ActionsInvocationRecord" - }, - "actions" : { - "_type" : { - "_name" : "Array" - }, - "_values" : [ - { - "_type" : { - "_name" : "ActionRecord" - }, - "actionResult" : { - "_type" : { - "_name" : "ActionResult" - }, - "coverage" : { - "_type" : { - "_name" : "CodeCoverageInfo" - } - }, - "issues" : { - "_type" : { - "_name" : "ResultIssueSummaries" - } - }, - "metrics" : { - "_type" : { - "_name" : "ResultMetrics" - } - }, - "resultName" : { - "_type" : { - "_name" : "String" - }, - "_value" : "action" - }, - "status" : { - "_type" : { - "_name" : "String" - }, - "_value" : "notRequested" - } - }, - "buildResult" : { - "_type" : { - "_name" : "ActionResult" - }, - "coverage" : { - "_type" : { - "_name" : "CodeCoverageInfo" - } - }, - "issues" : { - "_type" : { - "_name" : "ResultIssueSummaries" - } - }, - "logRef" : { - "_type" : { - "_name" : "Reference" - }, - "id" : { - "_type" : { - "_name" : "String" - }, - "_value" : "0~XBP6QfgBACcao7crWD8_8W18SPIqMzlK0U0oBhSvElOM8k-vQKO4ZmCtUhL-BfTDFSylC3qEPStUI3jNsBPTXA==" - }, - "targetType" : { - "_type" : { - "_name" : "TypeDefinition" - }, - "name" : { - "_type" : { - "_name" : "String" - }, - "_value" : "ActivityLogSection" - } - } - }, - "metrics" : { - "_type" : { - "_name" : "ResultMetrics" - } - }, - "resultName" : { - "_type" : { - "_name" : "String" - }, - "_value" : "build" - }, - "status" : { - "_type" : { - "_name" : "String" - }, - "_value" : "succeeded" - } - }, - "endedTime" : { - "_type" : { - "_name" : "Date" - }, - "_value" : "2021-10-27T13:13:38.875-0700" - }, - "runDestination" : { - "_type" : { - "_name" : "ActionRunDestinationRecord" - }, - "displayName" : { - "_type" : { - "_name" : "String" - }, - "_value" : "Any iOS Device" - }, - "localComputerRecord" : { - "_type" : { - "_name" : "ActionDeviceRecord" - }, - "busSpeedInMHz" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "100" - }, - "cpuCount" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "1" - }, - "cpuKind" : { - "_type" : { - "_name" : "String" - }, - "_value" : "12-Core Intel Xeon E5" - }, - "cpuSpeedInMHz" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "2700" - }, - "identifier" : { - "_type" : { - "_name" : "String" - }, - "_value" : "2BE58010-D352-540B-92E6-9A945BA6D36D" - }, - "isConcreteDevice" : { - "_type" : { - "_name" : "Bool" - }, - "_value" : "true" - }, - "logicalCPUCoresPerPackage" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "24" - }, - "modelCode" : { - "_type" : { - "_name" : "String" - }, - "_value" : "MacPro6,1" - }, - "modelName" : { - "_type" : { - "_name" : "String" - }, - "_value" : "Mac Pro" - }, - "modelUTI" : { - "_type" : { - "_name" : "String" - }, - "_value" : "com.apple.macpro-cylinder" - }, - "name" : { - "_type" : { - "_name" : "String" - }, - "_value" : "My Mac" - }, - "nativeArchitecture" : { - "_type" : { - "_name" : "String" - }, - "_value" : "x86_64" - }, - "operatingSystemVersion" : { - "_type" : { - "_name" : "String" - }, - "_value" : "11.6" - }, - "operatingSystemVersionWithBuildNumber" : { - "_type" : { - "_name" : "String" - }, - "_value" : "11.6 (20G165)" - }, - "physicalCPUCoresPerPackage" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "12" - }, - "platformRecord" : { - "_type" : { - "_name" : "ActionPlatformRecord" - }, - "identifier" : { - "_type" : { - "_name" : "String" - }, - "_value" : "com.apple.platform.macosx" - }, - "userDescription" : { - "_type" : { - "_name" : "String" - }, - "_value" : "macOS" - } - }, - "ramSizeInMegabytes" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "65536" - } - }, - "targetArchitecture" : { - "_type" : { - "_name" : "String" - }, - "_value" : "arm64e" - }, - "targetDeviceRecord" : { - "_type" : { - "_name" : "ActionDeviceRecord" - }, - "busSpeedInMHz" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "0" - }, - "cpuCount" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "0" - }, - "cpuSpeedInMHz" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "0" - }, - "identifier" : { - "_type" : { - "_name" : "String" - }, - "_value" : "dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder" - }, - "logicalCPUCoresPerPackage" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "0" - }, - "modelCode" : { - "_type" : { - "_name" : "String" - }, - "_value" : "GenericiOS" - }, - "modelName" : { - "_type" : { - "_name" : "String" - }, - "_value" : "GenericiOS" - }, - "modelUTI" : { - "_type" : { - "_name" : "String" - }, - "_value" : "com.apple.dt.Xcode.device.GenericiOS" - }, - "name" : { - "_type" : { - "_name" : "String" - }, - "_value" : "Any iOS Device" - }, - "nativeArchitecture" : { - "_type" : { - "_name" : "String" - }, - "_value" : "arm64e" - }, - "physicalCPUCoresPerPackage" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "0" - }, - "platformRecord" : { - "_type" : { - "_name" : "ActionPlatformRecord" - }, - "identifier" : { - "_type" : { - "_name" : "String" - }, - "_value" : "com.apple.platform.iphoneos" - }, - "userDescription" : { - "_type" : { - "_name" : "String" - }, - "_value" : "iOS" - } - }, - "ramSizeInMegabytes" : { - "_type" : { - "_name" : "Int" - }, - "_value" : "0" - } - }, - "targetSDKRecord" : { - "_type" : { - "_name" : "ActionSDKRecord" - }, - "identifier" : { - "_type" : { - "_name" : "String" - }, - "_value" : "iphoneos15.0" - }, - "name" : { - "_type" : { - "_name" : "String" - }, - "_value" : "iOS 15.0" - }, - "operatingSystemVersion" : { - "_type" : { - "_name" : "String" - }, - "_value" : "15.0" - } - } - }, - "schemeCommandName" : { - "_type" : { - "_name" : "String" - }, - "_value" : "Run" - }, - "schemeTaskName" : { - "_type" : { - "_name" : "String" - }, - "_value" : "Build" - }, - "startedTime" : { - "_type" : { - "_name" : "Date" - }, - "_value" : "2021-10-27T13:13:02.396-0700" - }, - "title" : { - "_type" : { - "_name" : "String" - }, - "_value" : "Build \"XCResultTestApp\"" - } - } - ] - }, - "issues" : { - "_type" : { - "_name" : "ResultIssueSummaries" - } - }, - "metadataRef" : { - "_type" : { - "_name" : "Reference" - }, - "id" : { - "_type" : { - "_name" : "String" - }, - "_value" : "0~4PY3oMxYEC19JHgIcIfOFnFe-ngUSzJD4NzcBevC8Y2-5y41lCyXxYXhi9eObvKdlU14arnDn8ilaTw6B_bbQQ==" - }, - "targetType" : { - "_type" : { - "_name" : "TypeDefinition" - }, - "name" : { - "_type" : { - "_name" : "String" - }, - "_value" : "ActionsInvocationMetadata" - } - } - }, - "metrics" : { - "_type" : { - "_name" : "ResultMetrics" - } - } -} - -'''; - const String _tempResultPath = 'temp'; diff --git a/packages/flutter_tools/test/general.shard/ios/xcresult_test_data.dart b/packages/flutter_tools/test/general.shard/ios/xcresult_test_data.dart new file mode 100644 index 0000000000..30156b83eb --- /dev/null +++ b/packages/flutter_tools/test/general.shard/ios/xcresult_test_data.dart @@ -0,0 +1,1573 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/// An example xcresult bundle json with invalid issues map. +const String kSampleResultJsonInvalidIssuesMap = r''' +{ + "_type" : { + "_name" : "ActionsInvocationRecord" + }, + "actions" : { + "_type" : { + "_name" : "Array" + }, + "_values" : [ + { + "buildResult": { + } + } + ] + } +} +'''; + +/// An example xcresult bundle json with invalid build result map. +const String kSampleResultJsonInvalidBuildResultMap = r''' +{ + "_type" : { + "_name" : "ActionsInvocationRecord" + }, + "actions" : { + "_type" : { + "_name" : "Array" + }, + "_values" : [ + {} + ] + } +} +'''; + + +/// An example xcresult bundle json with invalid action map. +const String kSampleResultJsonInvalidActionMap = r''' +{ + "_type" : { + "_name" : "ActionsInvocationRecord" + }, + "actions" : { + "_type" : { + "_name" : "Array" + }, + "_values" : [ + [] + ] + } +} +'''; + +/// An example xcresult bundle json that contains empty actions map. +const String kSampleResultJsonEmptyActionsMap = r''' +{ + "_type" : { + "_name" : "ActionsInvocationRecord" + }, + "actions" : { + "_type" : { + "_name" : "Array" + }, + "_values" : [ + ] + } +} +'''; + +/// An example xcresult bundle json that contains some warning and some errors. +const String kSampleResultJsonWithIssues = r''' +{ + "_type" : { + "_name" : "ActionsInvocationRecord" + }, + "actions" : { + "_type" : { + "_name" : "Array" + }, + "_values" : [ + { + "_type" : { + "_name" : "ActionRecord" + }, + "actionResult" : { + "_type" : { + "_name" : "ActionResult" + }, + "coverage" : { + "_type" : { + "_name" : "CodeCoverageInfo" + } + }, + "issues" : { + "_type" : { + "_name" : "ResultIssueSummaries" + } + }, + "metrics" : { + "_type" : { + "_name" : "ResultMetrics" + } + }, + "resultName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "action" + }, + "status" : { + "_type" : { + "_name" : "String" + }, + "_value" : "notRequested" + } + }, + "buildResult" : { + "_type" : { + "_name" : "ActionResult" + }, + "coverage" : { + "_type" : { + "_name" : "CodeCoverageInfo" + } + }, + "issues" : { + "_type" : { + "_name" : "ResultIssueSummaries" + }, + "errorSummaries" : { + "_type" : { + "_name" : "Array" + }, + "_values" : [ + { + "_type" : { + "_name" : "IssueSummary" + }, + "documentLocationInCreatingWorkspace" : { + "_type" : { + "_name" : "DocumentLocation" + }, + "concreteTypeName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "DVTTextDocumentLocation" + }, + "url" : { + "_type" : { + "_name" : "String" + }, + "_value" : "file:\/\/\/Users\/m\/Projects\/test_create\/ios\/Runner\/AppDelegate.m#CharacterRangeLen=0&CharacterRangeLoc=263&EndingColumnNumber=56&EndingLineNumber=7&LocationEncoding=1&StartingColumnNumber=56&StartingLineNumber=7" + } + }, + "issueType" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Semantic Issue" + }, + "message" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Use of undeclared identifier 'asdas'" + } + } + ] + }, + "warningSummaries" : { + "_type" : { + "_name" : "Array" + }, + "_values" : [ + { + "_type" : { + "_name" : "IssueSummary" + }, + "issueType" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Warning" + }, + "message" : { + "_type" : { + "_name" : "String" + }, + "_value" : "The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99." + } + } + ] + } + }, + "logRef" : { + "_type" : { + "_name" : "Reference" + }, + "id" : { + "_type" : { + "_name" : "String" + }, + "_value" : "0~bjiFq9EH53z6VfWSr47dakT0w_aGcY_GFqgPuexHq1JsoKMmvf_6GLglMcWBYRCSNufKEX6l1YgbFmnuobsw5w==" + }, + "targetType" : { + "_type" : { + "_name" : "TypeDefinition" + }, + "name" : { + "_type" : { + "_name" : "String" + }, + "_value" : "ActivityLogSection" + } + } + }, + "metrics" : { + "_type" : { + "_name" : "ResultMetrics" + }, + "errorCount" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "1" + }, + "warningCount" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "1" + } + }, + "resultName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "build" + }, + "status" : { + "_type" : { + "_name" : "String" + }, + "_value" : "failed" + } + }, + "endedTime" : { + "_type" : { + "_name" : "Date" + }, + "_value" : "2020-09-28T14:31:16.931-0700" + }, + "runDestination" : { + "_type" : { + "_name" : "ActionRunDestinationRecord" + }, + "displayName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Any iOS Device" + }, + "localComputerRecord" : { + "_type" : { + "_name" : "ActionDeviceRecord" + }, + "busSpeedInMHz" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "100" + }, + "cpuCount" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "1" + }, + "cpuKind" : { + "_type" : { + "_name" : "String" + }, + "_value" : "8-Core Intel Xeon W" + }, + "cpuSpeedInMHz" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "3200" + }, + "identifier" : { + "_type" : { + "_name" : "String" + }, + "_value" : "87BE7059-56E3-5470-B52D-31A0F76402B3" + }, + "isConcreteDevice" : { + "_type" : { + "_name" : "Bool" + }, + "_value" : "true" + }, + "logicalCPUCoresPerPackage" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "16" + }, + "modelCode" : { + "_type" : { + "_name" : "String" + }, + "_value" : "iMacPro1,1" + }, + "modelName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "iMac Pro" + }, + "modelUTI" : { + "_type" : { + "_name" : "String" + }, + "_value" : "com.apple.imacpro-2017" + }, + "name" : { + "_type" : { + "_name" : "String" + }, + "_value" : "My Mac" + }, + "nativeArchitecture" : { + "_type" : { + "_name" : "String" + }, + "_value" : "x86_64h" + }, + "operatingSystemVersion" : { + "_type" : { + "_name" : "String" + }, + "_value" : "10.15.5" + }, + "operatingSystemVersionWithBuildNumber" : { + "_type" : { + "_name" : "String" + }, + "_value" : "10.15.5 (19F101)" + }, + "physicalCPUCoresPerPackage" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "8" + }, + "platformRecord" : { + "_type" : { + "_name" : "ActionPlatformRecord" + }, + "identifier" : { + "_type" : { + "_name" : "String" + }, + "_value" : "com.apple.platform.macosx" + }, + "userDescription" : { + "_type" : { + "_name" : "String" + }, + "_value" : "macOS" + } + }, + "ramSizeInMegabytes" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "65536" + } + }, + "targetArchitecture" : { + "_type" : { + "_name" : "String" + }, + "_value" : "arm64e" + }, + "targetDeviceRecord" : { + "_type" : { + "_name" : "ActionDeviceRecord" + }, + "identifier" : { + "_type" : { + "_name" : "String" + }, + "_value" : "dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder" + }, + "modelCode" : { + "_type" : { + "_name" : "String" + }, + "_value" : "GenericiOS" + }, + "modelName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "GenericiOS" + }, + "modelUTI" : { + "_type" : { + "_name" : "String" + }, + "_value" : "com.apple.dt.Xcode.device.GenericiOS" + }, + "name" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Any iOS Device" + }, + "nativeArchitecture" : { + "_type" : { + "_name" : "String" + }, + "_value" : "arm64e" + }, + "platformRecord" : { + "_type" : { + "_name" : "ActionPlatformRecord" + }, + "identifier" : { + "_type" : { + "_name" : "String" + }, + "_value" : "com.apple.platform.iphoneos" + }, + "userDescription" : { + "_type" : { + "_name" : "String" + }, + "_value" : "iOS" + } + } + }, + "targetSDKRecord" : { + "_type" : { + "_name" : "ActionSDKRecord" + }, + "identifier" : { + "_type" : { + "_name" : "String" + }, + "_value" : "iphoneos14.0" + }, + "name" : { + "_type" : { + "_name" : "String" + }, + "_value" : "iOS 14.0" + }, + "operatingSystemVersion" : { + "_type" : { + "_name" : "String" + }, + "_value" : "14.0" + } + } + }, + "schemeCommandName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Run" + }, + "schemeTaskName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Build" + }, + "startedTime" : { + "_type" : { + "_name" : "Date" + }, + "_value" : "2020-09-28T14:31:13.125-0700" + }, + "title" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Build \"Runner\"" + } + } + ] + }, + "issues" : { + "_type" : { + "_name" : "ResultIssueSummaries" + }, + "errorSummaries" : { + "_type" : { + "_name" : "Array" + }, + "_values" : [ + { + "_type" : { + "_name" : "IssueSummary" + }, + "documentLocationInCreatingWorkspace" : { + "_type" : { + "_name" : "DocumentLocation" + }, + "concreteTypeName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "DVTTextDocumentLocation" + }, + "url" : { + "_type" : { + "_name" : "String" + }, + "_value" : "file:\/\/\/Users\/m\/Projects\/test_create\/ios\/Runner\/AppDelegate.m#CharacterRangeLen=0&CharacterRangeLoc=263&EndingColumnNumber=56&EndingLineNumber=7&LocationEncoding=1&StartingColumnNumber=56&StartingLineNumber=7" + } + }, + "issueType" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Semantic Issue" + }, + "message" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Use of undeclared identifier 'asdas'" + } + } + ] + }, + "warningSummaries" : { + "_type" : { + "_name" : "Array" + }, + "_values" : [ + { + "_type" : { + "_name" : "IssueSummary" + }, + "issueType" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Warning" + }, + "message" : { + "_type" : { + "_name" : "String" + }, + "_value" : "The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99." + } + } + ] + } + }, + "metadataRef" : { + "_type" : { + "_name" : "Reference" + }, + "id" : { + "_type" : { + "_name" : "String" + }, + "_value" : "0~hrKQOFMo2Ri-TrlvSpVK8vTHcYQxwuWYJuRHCjoxIleliOdh5fHOdfIALZV0S0FtjVmUB83FpKkPbWajga4wxA==" + }, + "targetType" : { + "_type" : { + "_name" : "TypeDefinition" + }, + "name" : { + "_type" : { + "_name" : "String" + }, + "_value" : "ActionsInvocationMetadata" + } + } + }, + "metrics" : { + "_type" : { + "_name" : "ResultMetrics" + }, + "errorCount" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "1" + }, + "warningCount" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "1" + } + } +} +'''; + +/// An example xcresult bundle json that contains some warning and some errors. +const String kSampleResultJsonWithIssuesAndInvalidUrl = r''' +{ + "_type" : { + "_name" : "ActionsInvocationRecord" + }, + "actions" : { + "_type" : { + "_name" : "Array" + }, + "_values" : [ + { + "_type" : { + "_name" : "ActionRecord" + }, + "actionResult" : { + "_type" : { + "_name" : "ActionResult" + }, + "coverage" : { + "_type" : { + "_name" : "CodeCoverageInfo" + } + }, + "issues" : { + "_type" : { + "_name" : "ResultIssueSummaries" + } + }, + "metrics" : { + "_type" : { + "_name" : "ResultMetrics" + } + }, + "resultName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "action" + }, + "status" : { + "_type" : { + "_name" : "String" + }, + "_value" : "notRequested" + } + }, + "buildResult" : { + "_type" : { + "_name" : "ActionResult" + }, + "coverage" : { + "_type" : { + "_name" : "CodeCoverageInfo" + } + }, + "issues" : { + "_type" : { + "_name" : "ResultIssueSummaries" + }, + "errorSummaries" : { + "_type" : { + "_name" : "Array" + }, + "_values" : [ + { + "_type" : { + "_name" : "IssueSummary" + }, + "documentLocationInCreatingWorkspace" : { + "_type" : { + "_name" : "DocumentLocation" + }, + "concreteTypeName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "DVTTextDocumentLocation" + }, + "url" : { + "_type" : { + "_name" : "String" + }, + "_value" : "3:00" + } + }, + "issueType" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Semantic Issue" + }, + "message" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Use of undeclared identifier 'asdas'" + } + } + ] + }, + "warningSummaries" : { + "_type" : { + "_name" : "Array" + }, + "_values" : [ + { + "_type" : { + "_name" : "IssueSummary" + }, + "issueType" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Warning" + }, + "message" : { + "_type" : { + "_name" : "String" + }, + "_value" : "The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99." + } + } + ] + } + }, + "logRef" : { + "_type" : { + "_name" : "Reference" + }, + "id" : { + "_type" : { + "_name" : "String" + }, + "_value" : "0~bjiFq9EH53z6VfWSr47dakT0w_aGcY_GFqgPuexHq1JsoKMmvf_6GLglMcWBYRCSNufKEX6l1YgbFmnuobsw5w==" + }, + "targetType" : { + "_type" : { + "_name" : "TypeDefinition" + }, + "name" : { + "_type" : { + "_name" : "String" + }, + "_value" : "ActivityLogSection" + } + } + }, + "metrics" : { + "_type" : { + "_name" : "ResultMetrics" + }, + "errorCount" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "1" + }, + "warningCount" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "1" + } + }, + "resultName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "build" + }, + "status" : { + "_type" : { + "_name" : "String" + }, + "_value" : "failed" + } + }, + "endedTime" : { + "_type" : { + "_name" : "Date" + }, + "_value" : "2020-09-28T14:31:16.931-0700" + }, + "runDestination" : { + "_type" : { + "_name" : "ActionRunDestinationRecord" + }, + "displayName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Any iOS Device" + }, + "localComputerRecord" : { + "_type" : { + "_name" : "ActionDeviceRecord" + }, + "busSpeedInMHz" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "100" + }, + "cpuCount" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "1" + }, + "cpuKind" : { + "_type" : { + "_name" : "String" + }, + "_value" : "8-Core Intel Xeon W" + }, + "cpuSpeedInMHz" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "3200" + }, + "identifier" : { + "_type" : { + "_name" : "String" + }, + "_value" : "87BE7059-56E3-5470-B52D-31A0F76402B3" + }, + "isConcreteDevice" : { + "_type" : { + "_name" : "Bool" + }, + "_value" : "true" + }, + "logicalCPUCoresPerPackage" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "16" + }, + "modelCode" : { + "_type" : { + "_name" : "String" + }, + "_value" : "iMacPro1,1" + }, + "modelName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "iMac Pro" + }, + "modelUTI" : { + "_type" : { + "_name" : "String" + }, + "_value" : "com.apple.imacpro-2017" + }, + "name" : { + "_type" : { + "_name" : "String" + }, + "_value" : "My Mac" + }, + "nativeArchitecture" : { + "_type" : { + "_name" : "String" + }, + "_value" : "x86_64h" + }, + "operatingSystemVersion" : { + "_type" : { + "_name" : "String" + }, + "_value" : "10.15.5" + }, + "operatingSystemVersionWithBuildNumber" : { + "_type" : { + "_name" : "String" + }, + "_value" : "10.15.5 (19F101)" + }, + "physicalCPUCoresPerPackage" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "8" + }, + "platformRecord" : { + "_type" : { + "_name" : "ActionPlatformRecord" + }, + "identifier" : { + "_type" : { + "_name" : "String" + }, + "_value" : "com.apple.platform.macosx" + }, + "userDescription" : { + "_type" : { + "_name" : "String" + }, + "_value" : "macOS" + } + }, + "ramSizeInMegabytes" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "65536" + } + }, + "targetArchitecture" : { + "_type" : { + "_name" : "String" + }, + "_value" : "arm64e" + }, + "targetDeviceRecord" : { + "_type" : { + "_name" : "ActionDeviceRecord" + }, + "identifier" : { + "_type" : { + "_name" : "String" + }, + "_value" : "dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder" + }, + "modelCode" : { + "_type" : { + "_name" : "String" + }, + "_value" : "GenericiOS" + }, + "modelName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "GenericiOS" + }, + "modelUTI" : { + "_type" : { + "_name" : "String" + }, + "_value" : "com.apple.dt.Xcode.device.GenericiOS" + }, + "name" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Any iOS Device" + }, + "nativeArchitecture" : { + "_type" : { + "_name" : "String" + }, + "_value" : "arm64e" + }, + "platformRecord" : { + "_type" : { + "_name" : "ActionPlatformRecord" + }, + "identifier" : { + "_type" : { + "_name" : "String" + }, + "_value" : "com.apple.platform.iphoneos" + }, + "userDescription" : { + "_type" : { + "_name" : "String" + }, + "_value" : "iOS" + } + } + }, + "targetSDKRecord" : { + "_type" : { + "_name" : "ActionSDKRecord" + }, + "identifier" : { + "_type" : { + "_name" : "String" + }, + "_value" : "iphoneos14.0" + }, + "name" : { + "_type" : { + "_name" : "String" + }, + "_value" : "iOS 14.0" + }, + "operatingSystemVersion" : { + "_type" : { + "_name" : "String" + }, + "_value" : "14.0" + } + } + }, + "schemeCommandName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Run" + }, + "schemeTaskName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Build" + }, + "startedTime" : { + "_type" : { + "_name" : "Date" + }, + "_value" : "2020-09-28T14:31:13.125-0700" + }, + "title" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Build \"Runner\"" + } + } + ] + }, + "issues" : { + "_type" : { + "_name" : "ResultIssueSummaries" + }, + "errorSummaries" : { + "_type" : { + "_name" : "Array" + }, + "_values" : [ + { + "_type" : { + "_name" : "IssueSummary" + }, + "documentLocationInCreatingWorkspace" : { + "_type" : { + "_name" : "DocumentLocation" + }, + "concreteTypeName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "DVTTextDocumentLocation" + }, + "url" : { + "_type" : { + "_name" : "String" + }, + "_value" : "file:\/\/\/Users\/m\/Projects\/test_create\/ios\/Runner\/AppDelegate.m#CharacterRangeLen=0&CharacterRangeLoc=263&EndingColumnNumber=56&EndingLineNumber=7&LocationEncoding=1&StartingColumnNumber=56&StartingLineNumber=7" + } + }, + "issueType" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Semantic Issue" + }, + "message" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Use of undeclared identifier 'asdas'" + } + } + ] + }, + "warningSummaries" : { + "_type" : { + "_name" : "Array" + }, + "_values" : [ + { + "_type" : { + "_name" : "IssueSummary" + }, + "issueType" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Warning" + }, + "message" : { + "_type" : { + "_name" : "String" + }, + "_value" : "The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99." + } + } + ] + } + }, + "metadataRef" : { + "_type" : { + "_name" : "Reference" + }, + "id" : { + "_type" : { + "_name" : "String" + }, + "_value" : "0~hrKQOFMo2Ri-TrlvSpVK8vTHcYQxwuWYJuRHCjoxIleliOdh5fHOdfIALZV0S0FtjVmUB83FpKkPbWajga4wxA==" + }, + "targetType" : { + "_type" : { + "_name" : "TypeDefinition" + }, + "name" : { + "_type" : { + "_name" : "String" + }, + "_value" : "ActionsInvocationMetadata" + } + } + }, + "metrics" : { + "_type" : { + "_name" : "ResultMetrics" + }, + "errorCount" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "1" + }, + "warningCount" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "1" + } + } +} +'''; + +/// An example xcresult bundle json that contains no issues. +const String kSampleResultJsonNoIssues = r''' +{ + "_type" : { + "_name" : "ActionsInvocationRecord" + }, + "actions" : { + "_type" : { + "_name" : "Array" + }, + "_values" : [ + { + "_type" : { + "_name" : "ActionRecord" + }, + "actionResult" : { + "_type" : { + "_name" : "ActionResult" + }, + "coverage" : { + "_type" : { + "_name" : "CodeCoverageInfo" + } + }, + "issues" : { + "_type" : { + "_name" : "ResultIssueSummaries" + } + }, + "metrics" : { + "_type" : { + "_name" : "ResultMetrics" + } + }, + "resultName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "action" + }, + "status" : { + "_type" : { + "_name" : "String" + }, + "_value" : "notRequested" + } + }, + "buildResult" : { + "_type" : { + "_name" : "ActionResult" + }, + "coverage" : { + "_type" : { + "_name" : "CodeCoverageInfo" + } + }, + "issues" : { + "_type" : { + "_name" : "ResultIssueSummaries" + } + }, + "logRef" : { + "_type" : { + "_name" : "Reference" + }, + "id" : { + "_type" : { + "_name" : "String" + }, + "_value" : "0~XBP6QfgBACcao7crWD8_8W18SPIqMzlK0U0oBhSvElOM8k-vQKO4ZmCtUhL-BfTDFSylC3qEPStUI3jNsBPTXA==" + }, + "targetType" : { + "_type" : { + "_name" : "TypeDefinition" + }, + "name" : { + "_type" : { + "_name" : "String" + }, + "_value" : "ActivityLogSection" + } + } + }, + "metrics" : { + "_type" : { + "_name" : "ResultMetrics" + } + }, + "resultName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "build" + }, + "status" : { + "_type" : { + "_name" : "String" + }, + "_value" : "succeeded" + } + }, + "endedTime" : { + "_type" : { + "_name" : "Date" + }, + "_value" : "2021-10-27T13:13:38.875-0700" + }, + "runDestination" : { + "_type" : { + "_name" : "ActionRunDestinationRecord" + }, + "displayName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Any iOS Device" + }, + "localComputerRecord" : { + "_type" : { + "_name" : "ActionDeviceRecord" + }, + "busSpeedInMHz" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "100" + }, + "cpuCount" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "1" + }, + "cpuKind" : { + "_type" : { + "_name" : "String" + }, + "_value" : "12-Core Intel Xeon E5" + }, + "cpuSpeedInMHz" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "2700" + }, + "identifier" : { + "_type" : { + "_name" : "String" + }, + "_value" : "2BE58010-D352-540B-92E6-9A945BA6D36D" + }, + "isConcreteDevice" : { + "_type" : { + "_name" : "Bool" + }, + "_value" : "true" + }, + "logicalCPUCoresPerPackage" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "24" + }, + "modelCode" : { + "_type" : { + "_name" : "String" + }, + "_value" : "MacPro6,1" + }, + "modelName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Mac Pro" + }, + "modelUTI" : { + "_type" : { + "_name" : "String" + }, + "_value" : "com.apple.macpro-cylinder" + }, + "name" : { + "_type" : { + "_name" : "String" + }, + "_value" : "My Mac" + }, + "nativeArchitecture" : { + "_type" : { + "_name" : "String" + }, + "_value" : "x86_64" + }, + "operatingSystemVersion" : { + "_type" : { + "_name" : "String" + }, + "_value" : "11.6" + }, + "operatingSystemVersionWithBuildNumber" : { + "_type" : { + "_name" : "String" + }, + "_value" : "11.6 (20G165)" + }, + "physicalCPUCoresPerPackage" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "12" + }, + "platformRecord" : { + "_type" : { + "_name" : "ActionPlatformRecord" + }, + "identifier" : { + "_type" : { + "_name" : "String" + }, + "_value" : "com.apple.platform.macosx" + }, + "userDescription" : { + "_type" : { + "_name" : "String" + }, + "_value" : "macOS" + } + }, + "ramSizeInMegabytes" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "65536" + } + }, + "targetArchitecture" : { + "_type" : { + "_name" : "String" + }, + "_value" : "arm64e" + }, + "targetDeviceRecord" : { + "_type" : { + "_name" : "ActionDeviceRecord" + }, + "busSpeedInMHz" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "0" + }, + "cpuCount" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "0" + }, + "cpuSpeedInMHz" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "0" + }, + "identifier" : { + "_type" : { + "_name" : "String" + }, + "_value" : "dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder" + }, + "logicalCPUCoresPerPackage" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "0" + }, + "modelCode" : { + "_type" : { + "_name" : "String" + }, + "_value" : "GenericiOS" + }, + "modelName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "GenericiOS" + }, + "modelUTI" : { + "_type" : { + "_name" : "String" + }, + "_value" : "com.apple.dt.Xcode.device.GenericiOS" + }, + "name" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Any iOS Device" + }, + "nativeArchitecture" : { + "_type" : { + "_name" : "String" + }, + "_value" : "arm64e" + }, + "physicalCPUCoresPerPackage" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "0" + }, + "platformRecord" : { + "_type" : { + "_name" : "ActionPlatformRecord" + }, + "identifier" : { + "_type" : { + "_name" : "String" + }, + "_value" : "com.apple.platform.iphoneos" + }, + "userDescription" : { + "_type" : { + "_name" : "String" + }, + "_value" : "iOS" + } + }, + "ramSizeInMegabytes" : { + "_type" : { + "_name" : "Int" + }, + "_value" : "0" + } + }, + "targetSDKRecord" : { + "_type" : { + "_name" : "ActionSDKRecord" + }, + "identifier" : { + "_type" : { + "_name" : "String" + }, + "_value" : "iphoneos15.0" + }, + "name" : { + "_type" : { + "_name" : "String" + }, + "_value" : "iOS 15.0" + }, + "operatingSystemVersion" : { + "_type" : { + "_name" : "String" + }, + "_value" : "15.0" + } + } + }, + "schemeCommandName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Run" + }, + "schemeTaskName" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Build" + }, + "startedTime" : { + "_type" : { + "_name" : "Date" + }, + "_value" : "2021-10-27T13:13:02.396-0700" + }, + "title" : { + "_type" : { + "_name" : "String" + }, + "_value" : "Build \"XCResultTestApp\"" + } + } + ] + }, + "issues" : { + "_type" : { + "_name" : "ResultIssueSummaries" + } + }, + "metadataRef" : { + "_type" : { + "_name" : "Reference" + }, + "id" : { + "_type" : { + "_name" : "String" + }, + "_value" : "0~4PY3oMxYEC19JHgIcIfOFnFe-ngUSzJD4NzcBevC8Y2-5y41lCyXxYXhi9eObvKdlU14arnDn8ilaTw6B_bbQQ==" + }, + "targetType" : { + "_type" : { + "_name" : "TypeDefinition" + }, + "name" : { + "_type" : { + "_name" : "String" + }, + "_value" : "ActionsInvocationMetadata" + } + } + }, + "metrics" : { + "_type" : { + "_name" : "ResultMetrics" + } + } +} +''';