Skip to content

Conversation

@cyanglaz
Copy link
Contributor

Add XCResultGenerator, this object generates an XCResult, which contains useful information in an iOS or macOS build.
As this initial version. XCResult only contains issues such as warning and error messages.

Part of #22536
After this lands, the build_ios.dart can adopt this and show the warning and error messages to the console.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Oct 27, 2021
@google-cla google-cla bot added the cla: yes label Oct 27, 2021
@cyanglaz cyanglaz requested a review from jmagman October 27, 2021 20:50
_kWhichSysctlCommand,
_kx64CheckCommand,
]);
final Xcode xcode = Xcode.test(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty squished, do you have your line lengths set to 120?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was 80, should it be 120?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christopherfujino Jonah and I both had it set to 120 but it's not enforced anywhere. What would you prefer here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The style guide says (which I personally try to follow):

Aim for a maximum line length of roughly 80 characters, but prefer going over if breaking the line would make it less readable, or if it would make the line less consistent with other nearby lines. Prefer avoiding line breaks after assignment operators.

https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#prefer-a-maximum-line-length-of-80-characters

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember framework repo doesn't require (and doesn't recommend) to use the dart formatter as sometimes the lines are sometimes too short to be readable. This is probably one of those cases. I will revert it back to 80 and do a manual scan to see if there are lines that are too short to be readable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even with 80 it will look better now that you added all the trailing commas.

@jmagman jmagman added the t: xcode "xcodebuild" on iOS and general Xcode project management label Oct 27, 2021
Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are failing

01:05 +1864 ~4 -1: test\general.shard\ios\xcresult_test.dart: error: `xcresulttool get` process fail should return an `XCResult with `parsingErrorMessage` as stderr. [E]                              
  Expected: 'Fake: fail to parse result json.'
    Actual: 'xcresult parser: Unrecognized top level json format.'
     Which: is different.
            Expected: Fake: fail ...
              Actual: xcresult p ...
                      ^
             Differ at offset 0
  
  package:test_api                                 expect
  test\general.shard\ios\xcresult_test.dart 127:5  main.<fn>

// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:convert' show json;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a forbidden import, instead use src/convert.dart

04:19 +18 -1: test\integration.shard\forbidden_imports_test.dart: no unauthorized imports of dart:convert [E]                                                                                          
  lib\src\ios\xcresult.dart imports 'dart:convert'; import 'lib/src/convert.dart' instead
  package:test_api                                           fail
  test\integration.shard\forbidden_imports_test.dart 207:13  main.<fn>
  test\src\common.dart 165:18                                test.<fn>
  test\src\common.dart 161:5                                 test.<fn

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor Author

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmagman Updated with all your comments, (now with the enum type and double checked line length), PTAL

// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:convert' show json;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

/// The type of the issue.
///
/// The possible values are `warning`, `error` etc.
final String type;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, done.
I made the enum named type, and added a subType field as String

Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit, thanks for the edits, LGTM!

/// `issueJson` is the object at xcresultJson[['actions']['_values'][0]['buildResult']['issues']['errorSummaries'/'warningSummaries']['_values'].
factory XCResultIssue(
{required XCResultIssueType type,
required Map<String, Object?> issueJson}) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing comma

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t: xcode "xcodebuild" on iOS and general Xcode project management tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants