Unverified Commit 1c4128c7 authored by Chris Yang's avatar Chris Yang Committed by GitHub

Xcode error message (#94747)

parent 710502c4
This diff is collapsed.
......@@ -545,6 +545,7 @@ class IOSSimulator extends Device {
deviceID: id,
);
if (!buildResult.success) {
await diagnoseXcodeBuildFailure(buildResult, globals.flutterUsage, globals.logger);
throwToolExit('Could not build the application for the simulator.');
}
......
......@@ -78,31 +78,8 @@ class XCResult {
/// Parse the `resultJson` and stores useful informations in the returned `XCResult`.
factory XCResult({required Map<String, Object?> resultJson, List<XCResultIssueDiscarder> issueDiscarders = const <XCResultIssueDiscarder>[]}) {
final List<XCResultIssue> issues = <XCResultIssue>[];
final Object? actionsMap = resultJson['actions'];
if (actionsMap == null || actionsMap is! Map<String, Object?>) {
return XCResult.failed(
errorMessage: 'xcresult parser: Failed to parse the actions map.');
}
final Object? actionValueList = actionsMap['_values'];
if (actionValueList == null ||
actionValueList is! List<Object?> ||
actionValueList.isEmpty) {
return XCResult.failed(
errorMessage: 'xcresult parser: Failed to parse the actions map.');
}
final Object? actionMap = actionValueList.first;
if (actionMap == null || actionMap is! Map<String, Object?>) {
return XCResult.failed(
errorMessage:
'xcresult parser: Failed to parse the first action map.');
}
final Object? buildResultMap = actionMap['buildResult'];
if (buildResultMap == null || buildResultMap is! Map<String, Object?>) {
return XCResult.failed(
errorMessage:
'xcresult parser: Failed to parse the buildResult map.');
}
final Object? issuesMap = buildResultMap['issues'];
final Object? issuesMap = resultJson['issues'];
if (issuesMap == null || issuesMap is! Map<String, Object?>) {
return XCResult.failed(
errorMessage: 'xcresult parser: Failed to parse the issues map.');
......
......@@ -58,6 +58,8 @@ const List<String> kRunReleaseArgs = <String>[
'id=123',
'ONLY_ACTIVE_ARCH=YES',
'ARCHS=arm64',
'-resultBundlePath', '/.tmp_rand0/flutter_ios_build_temp_dirrand0/temporary_xcresult_bundle',
'-resultBundleVersion', '3',
'FLUTTER_SUPPRESS_ANALYTICS=true',
'COMPILER_INDEX_STORE_ENABLE=NO',
];
......
......@@ -240,58 +240,17 @@ void main() {
'xcresult parser: Unrecognized top level json format.');
});
testWithoutContext('error: fail to parse actions map', () async {
testWithoutContext('error: fail to parse issue map', () async {
final XCResultGenerator generator = _setupGenerator(resultJson: '{}');
final XCResult result = await generator.generate();
expect(result.issues.length, 0);
expect(result.parseSuccess, false);
expect(result.parsingErrorMessage,
'xcresult parser: Failed to parse the actions map.');
});
testWithoutContext('error: empty actions map', () async {
final XCResultGenerator generator =
_setupGenerator(resultJson: kSampleResultJsonEmptyActionsMap);
final XCResult result = await generator.generate();
expect(result.issues.length, 0);
expect(result.parseSuccess, false);
expect(result.parsingErrorMessage,
'xcresult parser: Failed to parse the actions map.');
});
testWithoutContext('error: empty actions map', () async {
final XCResultGenerator generator = _setupGenerator(resultJson: kSampleResultJsonEmptyActionsMap);
final XCResult result = await generator.generate();
expect(result.issues.length, 0);
expect(result.parseSuccess, false);
expect(result.parsingErrorMessage,
'xcresult parser: Failed to parse the actions map.');
});
testWithoutContext('error: empty actions map', () async {
final XCResultGenerator generator = _setupGenerator(resultJson: kSampleResultJsonInvalidActionMap);
final XCResult result = await generator.generate();
expect(result.issues.length, 0);
expect(result.parseSuccess, false);
expect(result.parsingErrorMessage,
'xcresult parser: Failed to parse the first action map.');
});
testWithoutContext('error: empty actions map', () async {
final XCResultGenerator generator = _setupGenerator(resultJson: kSampleResultJsonInvalidBuildResultMap);
final XCResult result = await generator.generate();
expect(result.issues.length, 0);
expect(result.parseSuccess, false);
expect(result.parsingErrorMessage,
'xcresult parser: Failed to parse the buildResult map.');
'xcresult parser: Failed to parse the issues map.');
});
testWithoutContext('error: empty actions map', () async {
testWithoutContext('error: invalid issue map', () async {
final XCResultGenerator generator = _setupGenerator(resultJson: kSampleResultJsonInvalidIssuesMap);
final XCResult result = await generator.generate();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment