-
Notifications
You must be signed in to change notification settings - Fork 29.2k
Add more supported simulator debugging options and improve tests #114628
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
Conversation
…sts for other launch arguements
Discussed with @jmagman about improving this code by using a single function that returns the list of launch arguments that can then be used for both the iOS simulator and physical iOS. The upside of this would be less repeated code, and if someone wants to add a new flag in the future, they can add to just one place and won't have to remember to add to both simulators.dart and devices.dart. |
Also discussed how the simulator version only adds the flags if the flutter/packages/flutter_tools/lib/src/ios/simulators.dart Lines 432 to 448 in d40f6d1
Whereas the device version adds them regardless, and only adds 2 specific ones if flutter/packages/flutter_tools/lib/src/ios/devices.dart Lines 359 to 363 in d40f6d1
Since the iOS simulator only runs in debug mode (profile and release mode are not supported), we think it's okay to remove the |
…and physical devices
Note about cc03fe2. So I've discovered that having the quotes surrounding the flutter/packages/flutter_tools/lib/src/device.dart Lines 926 to 927 in cc03fe2
I tested this locally by using a single check for the dart flags and tried with and without quotes. Command I ran Test 1 - with quotes, physical device - PASS Test 2 - with quotes, simulator device - FAIL Test 3 - without quotes, physical device - FAIL Test 4 - without quotes, simulator device - PASS |
if (route != null) '--route=$route', | ||
if (environmentType == EnvironmentType.physical && (platformArgs['trace-startup'] as bool? ?? false)) '--trace-startup', | ||
if (enableImpeller) '--enable-impeller', | ||
if (environmentType == EnvironmentType.simulator) '--observatory-port=${hostVmServicePort ?? 0}', |
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 think it can go back to the behavior in https://github.com/flutter/flutter/pull/49735/files#diff-5a3d215e39f292ac706d495f042ef45fab9f13962022f4e8e4580254e8557d52L334 and pass the port along, if it's been set:
if (environmentType == EnvironmentType.simulator) '--observatory-port=${hostVmServicePort ?? 0}', | |
if (hasObservatoryPort) '--observatory-port=${hostVmServicePort}', |
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 differ between simulator and physical?
Looking at that change, looks like they used deviceVmServicePort
https://github.com/flutter/flutter/pull/49735/files#diff-5a3d215e39f292ac706d495f042ef45fab9f13962022f4e8e4580254e8557d52L335
Whereas it's hostVmServicePort
in original simulator args
'--observatory-port=${debuggingOptions.hostVmServicePort ?? 0}', |
Is it possible to have both a deviceVmServicePort
and hostVmServicePort
and if so, which should be used if both are provided?
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.
Good question, I had to ask @jonahwilliams for clarification here, this behavior has changed over time and not every spot it's used has been kept consistent.
To quote Jonah:
- Application runs on device, it starts up a VM Service instance. This instance will broadcast on a port + auth code combo.
- (Optional) If Host/Device are different machines, we forward the device port to a selected host port.
- (Optional) If dds is enabled, dds connects to the selected host port, then broadcasts on the dds port
For physical devices, the right thing to use is deviceVmServicePort
. The confusion is what to do if the "device" and host are really the same, as is the case with desktop apps or the iOS simulator, because there's no need to do port forwarding if they are the same machines. So I think hostVmServicePort
is correct in this case, though it's very confusing and it's likely we have some bugs in here.
@christopherfujino the host/device port logic could use cleanup, comments, better help text, perhaps variable renaming, and verification we're doing the right thing for all device types.
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.
@christopherfujino the host/device port logic could use cleanup, comments, better help text, perhaps variable renaming, and verification we're doing the right thing for all device types.
Agreed, let me make a tracking issue.
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.
Agreed, let me make a tracking issue.
Change --disable-service-auth-codes to not always be included for physical devices, only if disableServiceAuthCodes is true. Change --disable-observatory-publication to be used for simulator devices too. Change --enable-checked-mode & --verify-entry-points to be used if debuggingEnabled is true regardless of device type. Chnage --trace-startup to be used for simulator devices too.
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 LGTM with minor nits
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.
Thanks for tracking down all the weird corner cases.
* 3a656b1 Add more supported simulator debugging options and improve tests (flutter/flutter#114628) * 51c517c [flutter_tools/dap] Add support for forwarding `flutter run --machine` exposeUrl requests to the DAP client (flutter/flutter#114539) * 8e5439c Roll Flutter Engine from e7d7edab98ad to c76035429c36 (14 revisions) (flutter/flutter#115008) * a479718 Update cirrus key (flutter/flutter#115006) * dccc761 Roll Flutter Engine from c76035429c36 to aa4b3ea2f733 (27 revisions) (flutter/flutter#115025) * d0491dc Add the `channel` parameter to the Dartpad samples (flutter/flutter#115018) * befd8b6 722414a26 Implemented threadsafe platform channel replies on windows (flutter/engine#36909) (flutter/flutter#115033) * 154ae0f `updateSemantics` in TestWindow should always be implemented. (flutter/flutter#114857) * 008ac17 remove unnecessary brace in string interpolation (flutter/flutter#115032) * 8926d9e a9fbf6af5 Roll Fuchsia Linux SDK from mDzQK4ZUk_Y4wfZa_... to RNSA2Wp1MObtc7OHy... (flutter/engine#37485) (flutter/flutter#115045) * e6fb124 Roll Flutter Engine from a9fbf6af52c9 to b42ed6933cef (2 revisions) (flutter/flutter#115048) * ff75451 a42b2d9b9 Fix a race in the EmbedderA11yTest.A11yTreeIsConsistent tests (flutter/engine#37488) (flutter/flutter#115060) * c7d1154 a71c0c6c3 [Impeller] Support access the descriptor of PipelineFuture directly (flutter/engine#37415) (flutter/flutter#115063)
* 3a656b1 Add more supported simulator debugging options and improve tests (flutter/flutter#114628) * 51c517c [flutter_tools/dap] Add support for forwarding `flutter run --machine` exposeUrl requests to the DAP client (flutter/flutter#114539) * 8e5439c Roll Flutter Engine from e7d7edab98ad to c76035429c36 (14 revisions) (flutter/flutter#115008) * a479718 Update cirrus key (flutter/flutter#115006) * dccc761 Roll Flutter Engine from c76035429c36 to aa4b3ea2f733 (27 revisions) (flutter/flutter#115025) * d0491dc Add the `channel` parameter to the Dartpad samples (flutter/flutter#115018) * befd8b6 722414a26 Implemented threadsafe platform channel replies on windows (flutter/engine#36909) (flutter/flutter#115033) * 154ae0f `updateSemantics` in TestWindow should always be implemented. (flutter/flutter#114857) * 008ac17 remove unnecessary brace in string interpolation (flutter/flutter#115032) * 8926d9e a9fbf6af5 Roll Fuchsia Linux SDK from mDzQK4ZUk_Y4wfZa_... to RNSA2Wp1MObtc7OHy... (flutter/engine#37485) (flutter/flutter#115045) * e6fb124 Roll Flutter Engine from a9fbf6af52c9 to b42ed6933cef (2 revisions) (flutter/flutter#115048) * ff75451 a42b2d9b9 Fix a race in the EmbedderA11yTest.A11yTreeIsConsistent tests (flutter/engine#37488) (flutter/flutter#115060) * c7d1154 a71c0c6c3 [Impeller] Support access the descriptor of PipelineFuture directly (flutter/engine#37415) (flutter/flutter#115063)
* 3a656b1 Add more supported simulator debugging options and improve tests (flutter/flutter#114628) * 51c517c [flutter_tools/dap] Add support for forwarding `flutter run --machine` exposeUrl requests to the DAP client (flutter/flutter#114539) * 8e5439c Roll Flutter Engine from e7d7edab98ad to c76035429c36 (14 revisions) (flutter/flutter#115008) * a479718 Update cirrus key (flutter/flutter#115006) * dccc761 Roll Flutter Engine from c76035429c36 to aa4b3ea2f733 (27 revisions) (flutter/flutter#115025) * d0491dc Add the `channel` parameter to the Dartpad samples (flutter/flutter#115018) * befd8b6 722414a26 Implemented threadsafe platform channel replies on windows (flutter/engine#36909) (flutter/flutter#115033) * 154ae0f `updateSemantics` in TestWindow should always be implemented. (flutter/flutter#114857) * 008ac17 remove unnecessary brace in string interpolation (flutter/flutter#115032) * 8926d9e a9fbf6af5 Roll Fuchsia Linux SDK from mDzQK4ZUk_Y4wfZa_... to RNSA2Wp1MObtc7OHy... (flutter/engine#37485) (flutter/flutter#115045) * e6fb124 Roll Flutter Engine from a9fbf6af52c9 to b42ed6933cef (2 revisions) (flutter/flutter#115048) * ff75451 a42b2d9b9 Fix a race in the EmbedderA11yTest.A11yTreeIsConsistent tests (flutter/engine#37488) (flutter/flutter#115060) * c7d1154 a71c0c6c3 [Impeller] Support access the descriptor of PipelineFuture directly (flutter/engine#37415) (flutter/flutter#115063)
…tter#114628) * add debugging options to simulator, test more debugging flags, add tests for other launch arguements * refactor iOS launch arguments to use one function for both simulator and physical devices * treat dart flags differently between physical and simulator * Simplify some flags between devices. Change --disable-service-auth-codes to not always be included for physical devices, only if disableServiceAuthCodes is true. Change --disable-observatory-publication to be used for simulator devices too. Change --enable-checked-mode & --verify-entry-points to be used if debuggingEnabled is true regardless of device type. Chnage --trace-startup to be used for simulator devices too. * fix ios release mode with buildable app startApp test * determine observatory-port from deviceVmServicePort and hostVmServicePort * add comments and remove hasObservatoryPort
…tter#114628) * add debugging options to simulator, test more debugging flags, add tests for other launch arguements * refactor iOS launch arguments to use one function for both simulator and physical devices * treat dart flags differently between physical and simulator * Simplify some flags between devices. Change --disable-service-auth-codes to not always be included for physical devices, only if disableServiceAuthCodes is true. Change --disable-observatory-publication to be used for simulator devices too. Change --enable-checked-mode & --verify-entry-points to be used if debuggingEnabled is true regardless of device type. Chnage --trace-startup to be used for simulator devices too. * fix ios release mode with buildable app startApp test * determine observatory-port from deviceVmServicePort and hostVmServicePort * add comments and remove hasObservatoryPort
* 3a656b1 Add more supported simulator debugging options and improve tests (flutter/flutter#114628) * 51c517c [flutter_tools/dap] Add support for forwarding `flutter run --machine` exposeUrl requests to the DAP client (flutter/flutter#114539) * 8e5439c Roll Flutter Engine from e7d7edab98ad to c76035429c36 (14 revisions) (flutter/flutter#115008) * a479718 Update cirrus key (flutter/flutter#115006) * dccc761 Roll Flutter Engine from c76035429c36 to aa4b3ea2f733 (27 revisions) (flutter/flutter#115025) * d0491dc Add the `channel` parameter to the Dartpad samples (flutter/flutter#115018) * befd8b6 722414a26 Implemented threadsafe platform channel replies on windows (flutter/engine#36909) (flutter/flutter#115033) * 154ae0f `updateSemantics` in TestWindow should always be implemented. (flutter/flutter#114857) * 008ac17 remove unnecessary brace in string interpolation (flutter/flutter#115032) * 8926d9e a9fbf6af5 Roll Fuchsia Linux SDK from mDzQK4ZUk_Y4wfZa_... to RNSA2Wp1MObtc7OHy... (flutter/engine#37485) (flutter/flutter#115045) * e6fb124 Roll Flutter Engine from a9fbf6af52c9 to b42ed6933cef (2 revisions) (flutter/flutter#115048) * ff75451 a42b2d9b9 Fix a race in the EmbedderA11yTest.A11yTreeIsConsistent tests (flutter/engine#37488) (flutter/flutter#115060) * c7d1154 a71c0c6c3 [Impeller] Support access the descriptor of PipelineFuture directly (flutter/engine#37415) (flutter/flutter#115063)
Add more supported simulator debugging options update tests. Also, add tests for other launch arguments.
Fixes #52676.
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.