-
Notifications
You must be signed in to change notification settings - Fork 6k
Made et compilation errors relative to the CWD #56177
Conversation
4650d10 to
47de069
Compare
|
I worry this solution might be brittle. Would it be possible to have |
We're already invoking the If you are concerned about the regex being brittle:
|
| return min(multiplier * cores, 1000); | ||
| }(); | ||
|
|
||
| static final RegExp _gccRegex = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This library should probably not have too many smarts in it. This logic should probably go in the event handler in et somewhere around https://github.com/flutter/engine/blob/main/tools/engine_tool/lib/src/build_utils.dart#L156.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All messages aren't routed through the eventHandler today. Your proposal would require that to be the case. I would expect printing proper paths would be fundamental to BuildRunner and not something every client of BuildRunner should set up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All messages aren't routed through the
eventHandlertoday.
What's missing? Looking below, _ninjaProgress returns true only after it sends a line of output to the event handler, and when it returns false, there's an early return that also skips the path rewriting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printing proper paths would be fundamental
This library doesn't really "print" anything. That's the thinking behind the event handling part of the API. Clients of this API get to have an opinion about what the output seen by users looks like. If there's some data that clients need that isn't getting sent to the event handler, then we should fix that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's missing? Looking below, _ninjaProgress returns true only after it sends a line of output to the event handler, and when it returns false, there's an early return that also skips the path rewriting.
_ninjaProgress is parsing the output from ninja (like this PR does) and selectively forwards it on to the event handler. In our case it doesn't forward it on since it isn't a progress message. That's why modifying the line had to happen in BuildRunner.
Clients of this API get to have an opinion about what the output seen by users looks like.
Today they don't, the output just gets forward to stdout without their opinion. I suspect you think everything that is getting printed out is going through et which isn't the case. Given the choice to print wrong paths or correct paths we don't have anyone that wants the wrong paths so I don't think it's worth making that optional or something where a user should express their opinion. In my view this is a bug and not a missing extension point where users can change the behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Yeah, you're right. I misread the code, and I see what you're saying now.
Here is my non-blocking advice: Similar to how progress information from ninja is parsed out and handed to the client as a RunnerProgress event, add a function like _ninjaError or _compilerError that parses out compiler messages (errors/warnings/notes) and hands them to the client with a RunnerError event. This way et will have the option of collecting/displaying compiler messages however it likes. Other use cases might be adding color/emoji/ascii art, writing to a json file, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I agree with Zach's (ultimate) position, but also agree it should be non-blocking - this is a strict improvement, is tested, and is small in scope. The most I would ask is a TODO/GH issue tracking improving this by uplifting it as a _xError, but not as a blocker for landing this (positive) change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| return min(multiplier * cores, 1000); | ||
| }(); | ||
|
|
||
| static final RegExp _gccRegex = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I agree with Zach's (ultimate) position, but also agree it should be non-blocking - this is a strict improvement, is tested, and is small in scope. The most I would ask is a TODO/GH issue tracking improving this by uplifting it as a _xError, but not as a blocker for landing this (positive) change.
|
|
||
| /// Converts relative [path], who is relative to [dirPath] to a relative path | ||
| /// of the `CWD`. | ||
| static String _makeRelative(String path, String dirPath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious what this does meaningfully diferent than using the optional parameter from in p.relative: https://pub.dev/documentation/path/latest/path/relative.html?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from is confusing, it replaces the CWD part of the equation not were the path is relative to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack, thanks!
|
|
||
| /// Takes a [line] from compilation and makes the path relative to `CWD` where | ||
| /// the paths are relative to [outDir]. | ||
| static String fixGccPaths(String line, String outDir) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be @visibleForTesting if that is the intent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I omit that when the thing that is made visible is a pure function. Its visibility and usage can't hurt anything. I reserve @VisibleForTesting for things I want to be private but can't because of testing and using them in production can invalidate state. Happy to change it if that doesn't make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's less of a "can't hurt anything" and more "uh oh, we're now using this in other parts of the repo unexpectedly".
Let's make this @visibleForTesting the same way we'd make the function private if we could (this is package build_engine_config, not package gcc_stdio), if that makes sense. LGTM assuming we do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
…157833) flutter/engine@999797a...57ed5d3 2024-10-29 [email protected] [Flutter GPU] Fix MSAA sample size and HostBuffer alignment. (flutter/engine#56218) 2024-10-29 [email protected] Change default TileMode for blur ImageFilter objects to null (flutter/engine#55552) 2024-10-29 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Impeller] Reland: disable AHBs on devices that were upgraded to 29. (#56213)" (flutter/engine#56220) 2024-10-29 [email protected] Made et compilation errors relative to the CWD (flutter/engine#56177) 2024-10-29 [email protected] [Impeller] Reland: disable AHBs on devices that were upgraded to 29. (flutter/engine#56213) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
fixes flutter/flutter#157735
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.