Skip to content

Conversation

@miltosdoul
Copy link

@miltosdoul miltosdoul commented Feb 9, 2022

Updates Windows build error-matching regular expression to match error regarding invalid asset files added in pubspec.yaml project file.

Fixes #97065.

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.

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Feb 9, 2022
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@miltosdoul
Copy link
Author

I wasn't sure where to write tests for this so I didn't add any, if they are needed let me know where to add them.

@miltosdoul miltosdoul changed the title Update error matching regex in build_windows [flutter_tools] Update error matching regex in build_windows Feb 11, 2022
@christopherfujino
Copy link
Contributor

@stuartmorgan can you take a look at this one?

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

// MSBuild sends all output to stdout, including build errors. This surfaces
// known error patterns.
final RegExp errorMatcher = RegExp(r':\s*(?:warning|(?:fatal )?error).*?:');
final RegExp errorMatcher = RegExp(r':\s*(?:warning|(?:fatal )?error).*?:|.*Error detected in pubspec.yaml:.*|.*No file or variants found for asset: .*');
Copy link
Contributor

Choose a reason for hiding this comment

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

Having to encode the specific error message is very unfortunate; any other pubspec error is going to be missing all of the actual details until we add each one as it comes up. But without fundamentally reworking stream I don't have a better suggestion.

We should at least make this more maintainable and clearly documented though. Something like:

final List<String> errorMessages = <String>[
  r':\s*(?:warning|(?:fatal )?error).*?:',
  r'Error detected in pubspec.yaml:',
];
// Known secondary error lines for pubspec.yaml errors:
final List<String> pubspecErrorDetails = <String>[
  r'No file or variants found for asset:',
];
final RegExp errorMatcher = RegExp(<String>[
  ...errorMessages,
  ...pubspecErrorDetails,
].join('|'));

(Note that I have remove the leading and trailing .* from your strings. As you can see from the existing regex, this is not a full-line match.)

@christopherfujino christopherfujino added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 3, 2022
@christopherfujino
Copy link
Contributor

Closing this as stale. Feel free to re-open if you are ready to respond to code review. Thanks!

auto-submit bot pushed a commit that referenced this pull request Jul 31, 2023
Added Regex to match error message from verbos build as suggested by @stuartmorgan [here](#98137 (comment)).
Modified Windows Build Test

Fixes #97065
LouiseHsu pushed a commit to LouiseHsu/flutter that referenced this pull request Jul 31, 2023
Added Regex to match error message from verbos build as suggested by @stuartmorgan [here](flutter#98137 (comment)).
Modified Windows Build Test

Fixes flutter#97065
vashworth pushed a commit to vashworth/flutter that referenced this pull request Aug 2, 2023
Added Regex to match error message from verbos build as suggested by @stuartmorgan [here](flutter#98137 (comment)).
Modified Windows Build Test

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

Labels

tool Affects the "flutter" command-line tool. See also t: labels. waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] Build failed without clalify error if asset file not exist

3 participants