Skip to content

Conversation

@jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented Oct 2, 2020

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

@flutter-dashboard flutter-dashboard bot added tool Affects the "flutter" command-line tool. See also t: labels. work in progress; do not review labels Oct 2, 2020
@jonahwilliams jonahwilliams marked this pull request as ready for review October 5, 2020 15:37
<String>[
executable,
],
environment: _computeEnvironment(debuggingOptions, traceStartup, route),
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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;
Copy link
Contributor

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?

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

}
if (!debuggingOptions.debuggingEnabled) {
finish();
return environment;
Copy link
Contributor

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.)

Copy link
Contributor Author

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

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.

LGTM!

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.

Projects

None yet

3 participants