-
Notifications
You must be signed in to change notification settings - Fork 29.8k
[flutter_tools] support all engine debugging options with FLUTTER_ENGINE_SWITCH environment variables #67150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flutter_tools] support all engine debugging options with FLUTTER_ENGINE_SWITCH environment variables #67150
Conversation
| <String>[ | ||
| executable, | ||
| ], | ||
| environment: _computeEnvironment(debuggingOptions, traceStartup, route), |
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.
Do these options work in release mode on other platforms? Since they won't currently on desktop, maybe we should see if this is non-empty and if the build mode is release, output a warning that the options will be ignored and to file an issue describing their use case.
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.
The tooling will already ignore the unsupported values when constructing the debugging options object:
| DebuggingOptions _createDebuggingOptions() { |
That seems like a reasonable place to insert some logging to warn users if they are passing flags that have no effect.
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.
Filled #67315
| /// * FLUTTER_ENGINE_SWITCHES to the number of switches. | ||
| /// * FLUTTER_ENGINE_SWITCH_<N> (indexing from 1) to the individual switches. | ||
| Map<String, String> _computeEnvironment(DebuggingOptions debuggingOptions, bool traceStartup, String route) { | ||
| int flags = 1; |
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.
Wouldn't it be clearer to start this as zero, increment flags at the start of addFlag instead of the end, and not have to subtract in finish?
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
| } | ||
| if (!debuggingOptions.debuggingEnabled) { | ||
| finish(); | ||
| return environment; |
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.
Skimming, I almost missed that this was an early return instead of just another flag. Maybe wrap all the rest in if (debuggingOptions.debuggingEnabled) {...} instead of early return so it's clearer?
(As a concrete issue, I think there's a good chance that if I were ever to add anything to the flags here as currently written, I would accidentally add it to the end of the function not realizing that it wouldn't always get there.)
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.
Updated to only have a single return
stuartmorgan-g
left a comment
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.
LGTM!
Description
Allow providing all debugging options to the desktop engine via the FLUTTER_ENGINE_SWITCH_ environment variables.
Fixes #66532
Fixes #46005
Fixes #58882
The underling engine changes have already landed for Windows, macOS, but linux is still in progress