Skip to content

Conversation

@bkonyi
Copy link
Contributor

@bkonyi bkonyi commented Apr 10, 2024

This change is a major step towards moving away from shipping DDS via Pub.

The first component of this PR is the move away from importing package:dds to launch DDS. Instead, DDS is launched out of process using the dart development-service command shipped with the Dart SDK. This makes Flutter's handling of DDS consistent with the standalone Dart VM.

The second component of this PR is the initial work to prepare for the removal of instances of DevTools being served manually by the flutter_tool, instead relying on DDS to serve DevTools. This will be consistent with how the standalone Dart VM serves DevTools, tying the DevTools lifecycle to a live DDS instance. This will allow for the removal of much of the logic needed to properly manage the lifecycle of the DevTools server in a future PR. Also, by serving DevTools from DDS, users will no longer need to forward a secondary port in remote workflows as DevTools will be available on the DDS port.

There's two remaining circumstances that will prevent us from removing DevtoolsRunner completely:

  • The daemon's devtools.serve endpoint
  • flutter drive's --profile-memory flag used for recording memory profiles

This PR also includes some refactoring around DebuggingOptions to reduce the number of debugging related arguments being passed as parameters adjacent to a DebuggingOptions instance.

This change is a major step towards moving away from shipping DDS via
Pub.

The first component of this PR is the move away from importing
package:dds to launch DDS. Instead, DDS is launched out of process using
the `dart development-service` command shipped with the Dart SDK. This
makes Flutter's handling of DDS consistent with the standalone Dart VM.

The second component of this PR is the removal of instances of DevTools
being served manually by the flutter_tool, instead relying on DDS to
serve DevTools. This is consistent with how the standalone Dart VM
serves DevTools, tying the DevTools lifecycle to a live DDS instance.
This allows for the removal of much of the logic needed to properly
manage the lifecycle of the DevTools server. Also, by serving DevTools
from DDS, users will no longer need to forward a secondary port in
remote workflows as DevTools will be available on the DDS port.

There's two remaining circumstances preventing us from removing
DevtoolsRunner completely:

 - The daemon's `devtools.serve` endpoint
 - `flutter drive`'s `--profile-memory` flag used for recording memory
   profiles

This PR also includes some refactoring around `DebuggingOptions` to reduce
the number of debugging related arguments being passed as parameters
adjacent to a `DebuggingOptions` instance.
@bkonyi bkonyi marked this pull request as draft April 10, 2024 18:36
@github-actions github-actions bot added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. a: desktop Running on desktop labels Apr 10, 2024
@bkonyi bkonyi removed platform-ios iOS applications specifically a: desktop Running on desktop labels Apr 10, 2024
@github-actions github-actions bot added platform-ios iOS applications specifically a: desktop Running on desktop labels Apr 10, 2024
@bkonyi bkonyi marked this pull request as ready for review April 12, 2024 20:07
@bkonyi
Copy link
Contributor Author

bkonyi commented Apr 12, 2024

I think this is ready for a first pass. The failing integration test will be fixed once the Dart SDK roll picks up this CL. I still need to investigate what changes are needed for google3.

@christopherfujino
Copy link
Contributor

I scheduled time next week Monday to take a look at this tome :)

enableImpeller: ImpellerStatus.fromBool(argResults!['enable-impeller'] as bool?),
debugLogsDirectoryPath: debugLogsDirectoryPath,
webRenderer: webRenderer,
printDtd: boolArg(FlutterGlobalOptions.kPrintDtd, global: true),
Copy link
Member

Choose a reason for hiding this comment

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

we seem to repeat a lot of this arg parsing logic throughout flutter tools. Could be nice if there were some common getters to use

bool get printDtdFlag => boolArg(FlutterGlobalOptions.kPrintDtd, global: true);
bool get enableDevToolsFlag => boolArg(FlutterCommand.kEnableDevTools);
bool get disableServiceAuthCodesFlag => boolArg('disable-service-auth-codes');

but likely out of scope for this PR as this would be a larger cleanup

@christopherfujino
Copy link
Contributor

@bkonyi As I understand it, this PR is doing two different things:

  1. Changing the way the tool launches DDS from calling dds.DartDevelopmentService.startDartDevelopmentService from package:dds to spawning a sub-process via dart development-service
  2. Changing the way the tool launches DevTools from directly to via DDS

Do I have this right? And if so, would it be possible to split this into two separate PRs, both to make it easier to review and to minimize the impact if either of these changes needs to be reverted?

@bkonyi bkonyi changed the title Launch DDS from Dart SDK and serve DevTools from DDS Launch DDS from Dart SDK and prepare to serve DevTools from DDS Apr 17, 2024
@bkonyi
Copy link
Contributor Author

bkonyi commented Apr 17, 2024

@bkonyi As I understand it, this PR is doing two different things:

  1. Changing the way the tool launches DDS from calling dds.DartDevelopmentService.startDartDevelopmentService from package:dds to spawning a sub-process via dart development-service
  2. Changing the way the tool launches DevTools from directly to via DDS

Do I have this right? And if so, would it be possible to split this into two separate PRs, both to make it easier to review and to minimize the impact if either of these changes needs to be reverted?

I've gone ahead and reverted to using the ResidentDevToolsHandler code to manage the DevTools instance to reduce the surface area of this change. Much of the code needed to move over to serving DevTools from DDS is still present but commented out with TODOs and can be reviewed in the follow up PR.

There may be some tests still failing, but I think this is ready for a first pass.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 17, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 17, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 17, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 17, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 17, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 17, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 18, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 18, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 18, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 18, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 18, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 18, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 18, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 19, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 19, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 19, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 19, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 19, 2024
bkonyi added a commit that referenced this pull request Jul 26, 2024
auto-submit bot pushed a commit that referenced this pull request Jul 26, 2024
…DS (#146593)" (#152386)

This reverts commit 7cdc23b.

The failure in the `native_assets_test` integration test on Windows was caused by the DevTools process not being shutdown by the `ColdRunner` when running the profile mode portion of the test. This resulted in the test being unable to clean up the project created by the test as DevTools was still holding onto a handle within the directory. This PR adds back the mistakenly removed DevTools shutdown logic in the `ColdRunner`.
TytaniumDev pushed a commit to TytaniumDev/flutter that referenced this pull request Aug 7, 2024
…ter#146593)

This change is a major step towards moving away from shipping DDS via
Pub.

The first component of this PR is the move away from importing
package:dds to launch DDS. Instead, DDS is launched out of process using
the `dart development-service` command shipped with the Dart SDK. This
makes Flutter's handling of DDS consistent with the standalone Dart VM.

The second component of this PR is the initial work to prepare for the
removal of instances of DevTools being served manually by the
flutter_tool, instead relying on DDS to serve DevTools. This will be
consistent with how the standalone Dart VM serves DevTools, tying the
DevTools lifecycle to a live DDS instance. This will allow for the
removal of much of the logic needed to properly manage the lifecycle of
the DevTools server in a future PR. Also, by serving DevTools from DDS,
users will no longer need to forward a secondary port in remote
workflows as DevTools will be available on the DDS port. This code is currently 
commented out and will be enabled in a future PR.

There's two remaining circumstances that will prevent us from removing
DevtoolsRunner completely:

 - The daemon's `devtools.serve` endpoint
- `flutter drive`'s `--profile-memory` flag used for recording memory
profiles

This PR also includes some refactoring around `DebuggingOptions` to
reduce the number of debugging related arguments being passed as
parameters adjacent to a `DebuggingOptions` instance.
TytaniumDev pushed a commit to TytaniumDev/flutter that referenced this pull request Aug 7, 2024
…DDS (flutter#146593)" (flutter#151781)

Reverts: flutter#146593
Initiated by: zanderso
Reason for reverting: Consistently failing `Windows_android native_assets_android` as in https://ci.chromium.org/ui/p/flutter/builders/prod/Windows_android%20native_assets_android/2533/overview 
Original PR Author: bkonyi

Reviewed By: {christopherfujino, kenzieschmoll}

This change reverts the following previous change:
This change is a major step towards moving away from shipping DDS via Pub.

The first component of this PR is the move away from importing package:dds to launch DDS. Instead, DDS is launched out of process using the `dart development-service` command shipped with the Dart SDK. This makes Flutter's handling of DDS consistent with the standalone Dart VM.

The second component of this PR is the initial work to prepare for the removal of instances of DevTools being served manually by the flutter_tool, instead relying on DDS to serve DevTools. This will be consistent with how the standalone Dart VM serves DevTools, tying the DevTools lifecycle to a live DDS instance. This will allow for the removal of much of the logic needed to properly manage the lifecycle of the DevTools server in a future PR. Also, by serving DevTools from DDS, users will no longer need to forward a secondary port in remote workflows as DevTools will be available on the DDS port.

There's two remaining circumstances that will prevent us from removing DevtoolsRunner completely:

 - The daemon's `devtools.serve` endpoint
 - `flutter drive`'s `--profile-memory` flag used for recording memory profiles

This PR also includes some refactoring around `DebuggingOptions` to reduce the number of debugging related arguments being passed as parameters adjacent to a `DebuggingOptions` instance.
TytaniumDev pushed a commit to TytaniumDev/flutter that referenced this pull request Aug 7, 2024
…DS (flutter#146593)" (flutter#152386)

This reverts commit 7cdc23b.

The failure in the `native_assets_test` integration test on Windows was caused by the DevTools process not being shutdown by the `ColdRunner` when running the profile mode portion of the test. This resulted in the test being unable to clean up the project created by the test as DevTools was still holding onto a handle within the directory. This PR adds back the mistakenly removed DevTools shutdown logic in the `ColdRunner`.
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
…DS (flutter#146593)" (flutter#152386)

This reverts commit 7cdc23b.

The failure in the `native_assets_test` integration test on Windows was caused by the DevTools process not being shutdown by the `ColdRunner` when running the profile mode portion of the test. This resulted in the test being unable to clean up the project created by the test as DevTools was still holding onto a handle within the directory. This PR adds back the mistakenly removed DevTools shutdown logic in the `ColdRunner`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop autosubmit Merge PR when tree becomes green via auto submit App platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants